本文整理汇总了PHP中url_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP url_slug函数的具体用法?PHP url_slug怎么用?PHP url_slug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了url_slug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: f_getfromARow
function f_getfromARow(&$aFields, $fieldSearched, $fieldSearchedValue, $getField = null, $mode = "")
{
$nfield = 0;
if (strpos($mode, "-friendly-") !== false) {
$fieldSearchedValue = url_slug($fieldSearchedValue);
}
if (is_null($aFields)) {
echo "<br>null aFields :";
echo parse_backtrace(debug_backtrace());
return "";
}
$existcol = get_param($mode, "existcol");
foreach ($aFields as $key => $aField) {
if (strpos($mode, "-debug-") !== false) {
var_dump($aField);
}
$found = false;
//echo parse_backtrace(debug_backtrace());
if (array_key_exists($fieldSearched, $aField)) {
$fieldValue = strpos($mode, "-friendly-") !== false ? url_slug($aField[$fieldSearched]) : $aField[$fieldSearched];
if (strpos($mode, "-debug-") !== false) {
echo "<br>{$nfield}) fieldValue:" . $fieldValue . " recup: " . $aField[$getField] . " ppp:" . $aField[0] . "<br>";
}
if (strpos($mode, "-trim-") !== false) {
if ($fieldSearchedValue == $fieldValue) {
$found = true;
}
} else {
if (trim($fieldSearchedValue) == trim($fieldValue)) {
$found = true;
}
}
}
if ($found && $existcol != "" && !array_key_exists($existcol, $aField)) {
$found = false;
}
if ($found) {
if (strpos($mode, "-debug-") !== false) {
echo " ***encontrado.";
}
if ($getField === null) {
return $aField;
} elseif ($getField == -1) {
return $key;
//$nfield; // devuelva la fila donde está
} else {
if (array_key_exists($getField, $aField)) {
return $aField[$getField];
} else {
return "";
}
}
}
$nfield++;
}
return "";
}
示例2: getDownloadImage
function getDownloadImage($type, $file, $sottoCat, $nome_brand, $nome_colore, $id)
{
/*$path = str_replace("index.php","",$_SERVER["SCRIPT_FILENAME"]);
$import_location = $path.'media/catalog/';
if (!file_exists($import_location)){
mkdir($import_location, 0755);
}
$import_location = $path.'media/catalog/'.$type.'/';
if (!file_exists($import_location)){
mkdir($import_location, 0755);
}*/
$file_path = "";
// estensione foto
$ext = pathinfo($file, PATHINFO_EXTENSION);
if (strtolower($ext) == "jpg") {
// recupero il numero della foto
$punto = strrpos($file, ".");
$file_new = substr($file, 0, $punto);
// il numero dell'immagine
$numero_img = substr($file_new, strlen($file_new) - 1, 1);
$nome_file = replace_accents(url_slug(strtolower($sottoCat))) . "_" . replace_accents(url_slug(strtolower($nome_brand))) . "_" . replace_accents(url_slug(strtolower($nome_colore))) . "_" . replace_accents(url_slug(strtolower($id))) . "-" . $numero_img . "." . $ext;
$import_location = "../../var/images";
$file_source = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_imageurl', Mage::app()->getStore()) . $file;
$file_target = $import_location . "/" . $nome_file;
$file_source = str_replace(" ", "%20", $file_source);
if ($file != '' and !file_exists($file_target)) {
$rh = fopen($file_source, 'rb');
$wh = fopen($file_target, 'wb');
if ($rh === false || $wh === false) {
// error reading or opening file
$file_path = "";
} else {
while (!feof($rh)) {
if (fwrite($wh, fread($rh, 1024)) === FALSE) {
$file_path = $file_target;
}
}
}
fclose($rh);
fclose($wh);
}
if (file_exists($file_target)) {
if ($type == 'category') {
$file_path = $file;
} else {
$file_path = $file_target;
}
}
$img = new Imagick($file_path);
$img->setOption('jpeg:extent', '150kb');
$img->writeImage($file_path);
}
return $file_path;
}
示例3: insert_news
function insert_news($data_ar, $count_word = 10)
{
//принимает массив array('url','img','title','text','date') и минимальный размер текста(колличество шинглов/5) ;
// $data_ar['text'] = $this->clear_txt($data_ar['text']);
$data_ar['title'] = $this->CI->db->escape_str(strip_tags($data_ar['title']));
// $data_ar['donor'] = $this->get_donor_url($data_ar['url']);
$txtLenth = $this->txtLenth($data_ar['text']);
if ($txtLenth < 600) {
echo "error #1 small text <br />\n";
return FALSE;
}
$donorObj = new donorMsn($data_ar['donor-data']);
$donorId = $donorObj->getId();
$data_ar['text'] = $this->change_img_in_txt($data_ar['text'], $data_ar['url']);
//замена изображений в тексте
$data_ar['img_name'] = $this->load_img($data_ar['img'], $data_ar['url'], $data_ar['title']);
if ($data_ar['img_name']) {
// $this->resizeImg('medium');
$this->resizeImg('small');
}
$data_ar['url_name'] = url_slug($data_ar['title'], array('transliterate' => true));
$data_ar['title'] = html_entity_decode($data_ar['title'], ENT_QUOTES, 'UTF-8');
$data_ar['text'] = html_entity_decode($data_ar['text'], ENT_QUOTES, 'UTF-8');
// $sql = " INSERT INTO `article`
// SET
// `title` = '{$data_ar['title']}',
// `description` = '".$this->CI->db->escape_str($data_ar['description'])."',
// `text` = '".$this->CI->db->escape_str($data_ar['text']) ."',
// `cat_id` = '{$data_ar['cat_id']}',
// `main_img` = '{$data_ar['img_name']}',
// `date` = '{$data_ar['date']}',
// `url_name` = '{$data_ar['url_name']}',
// `scan_url_id` = '{$data_ar['scan_url_id']}',
// `donor_id` = '{$donorId}',
// `canonical` = '{$data_ar['canonical']}'
// ";
$sql2 = " INSERT INTO `article` \r\n SET\r\n `title` = ?, \r\n `description` = ?, \r\n `text` = ?,\r\n `cat_id` = '{$data_ar['cat_id']}', \r\n `main_img` = '{$data_ar['img_name']}',\r\n `date` = '{$data_ar['date']}',\r\n `url_name` = '{$data_ar['url_name']}',\r\n `scan_url_id` = '{$data_ar['scan_url_id']}',\r\n `donor_id` = '{$donorId}',\r\n `canonical` = '{$data_ar['canonical']}' \r\n ";
// echo $sql;
// $this->CI->db->query($sql);
$this->CI->db->query($sql2, array($data_ar['title'], $data_ar['description'], $data_ar['text']));
$article_id = $this->CI->db->insert_id();
echo 'ОК - Занесена новая новость ID# ' . $article_id . ' - ' . $data_ar['title'] . "<br />\n";
return TRUE;
}
示例4: insert_news
function insert_news($data_ar, $count_word = 10)
{
//принимает массив array('url','img','title','text','date') и минимальный размер текста(колличество шинглов/5) ;
$data_ar['text'] = $this->clear_txt($data_ar['text']);
$data_ar['title'] = $this->CI->db->escape_str(strip_tags($data_ar['title']));
$data_ar['donor'] = $this->get_donor_url($data_ar['url']);
$this_hash_ar = $this->get_shingles_hash($data_ar['text']);
if (count($this_hash_ar) < $count_word) {
echo "error #1 small text <br />\n";
return FALSE;
}
$like_hash_list = $this->get_like_news_hash($this_hash_ar, 20);
if ($like_hash_list != false) {
//сравнение хешей
foreach ($like_hash_list as $news_id => $like_hash_ar) {
if ($this->comparison_shingles_hash($this_hash_ar, $like_hash_ar, 50) == true) {
//если найденно совпадение текста
echo "error #2 clone text. CloneID-" . $news_id . ' ' . $data_ar['title'] . "<br />\n";
return FALSE;
}
}
}
$data_ar['text'] = $this->change_img_in_txt($data_ar['text'], $data_ar['url']);
//замена изображений в тексте
$data_ar['img_name'] = $this->load_img($data_ar['img'], $data_ar['url']);
if ($data_ar['img_name']) {
$this->resizeImg('medium');
$this->resizeImg('small');
}
// $data_ar['url_name'] = seoUrl($data_ar['title']);
$data_ar['url_name'] = url_slug($data_ar['title'], array('transliterate' => true));
$sql = " INSERT INTO `article` \n SET\n `title` = '{$data_ar['title']}', \n `text` = '" . $this->CI->db->escape_str($data_ar['text']) . "',\n `cat_id` = '{$data_ar['cat_id']}', \n `main_img` = '{$data_ar['img_name']}',\n `date` = '{$data_ar['date']}',\n `url_name` = '{$data_ar['url_name']}',\n `donor` = '{$data_ar['donor']}',\n `scan_url_id` = '{$data_ar['scan_url_id']}',\n `author_id` = '0',\n `donor_id` = '{$data_ar['donor_id']}'\n ";
$this->CI->db->query($sql);
$article_id = $this->CI->db->insert_id();
if ($article_id) {
#ID is "0" becouse "INSERT DELAYED INTO"
$this->CI->parser_m->add_shingles($this_hash_ar, $article_id);
}
echo 'ОК - Занесена новая новость ID# ' . $article_id . ' - ' . $data_ar['title'] . "<br />\n";
return TRUE;
}
示例5: Contenido
public function Contenido($id)
{
global $sql;
$this->notNulls = array(self::ID);
$this->data = new stdClass();
$this->nuevo = false;
$id = $sql->con->real_escape_string($id);
$this->id = $id;
$sql->readDB(self::TABLE, self::ID . "='" . strtolower($id) . "'");
if (($res = $sql->fetchAssoc()) && is_array($res)) {
$res['URL'] = url_slug($res['TITULO__CON']);
if (empty($res['FOTOGRANCON'])) {
$res['FOTOGRANCON'] = "NoDisponible.jpg";
}
$res['GALERIA_CON'] = trim($res['GALERIA_CON']);
$res['GALERIA_CON'] = unserialize($res['GALERIA_CON']);
if (is_array($res['GALERIA_CON'])) {
$tmp = $res['GALERIA_CON'];
$tmp = array_merge(array($res['FOTOGRANCON']), $res['GALERIA_CON']);
$c = 0;
$f = 0;
foreach ($tmp as $image) {
$res['slider'][$f][] = $image;
$c++;
if ($c == 4) {
$c = 0;
$f++;
}
}
}
$cur = $sql->readDB("CATEGORIA", "ID______CAT=" . $res["CATEGORICON"]);
if ($cat = $cur->fetch_assoc()) {
$res['REFERER'] = url_slug($cat["NOMBRE__CAT"]);
$res["JAVASCRIPT"] = "<script>var guide = '" . $res["REFERER"] . "';</script>";
}
$this->data->data = $res;
} else {
$this->nuevo = true;
}
$logged = false;
}
示例6: guardar
public function guardar($contenido_id = null)
{
$this->load->helper('file');
$respuesta = new stdClass();
if ($contenido_id) {
$contenido = Doctrine::getTable('Contenido')->find($contenido_id);
} else {
$contenido = new Contenido();
}
$this->form_validation->set_rules('titulo', 'Título', 'trim|required');
$this->form_validation->set_rules('contenido', 'Contenido', 'required');
if ($this->form_validation->run() == TRUE) {
try {
$url = !$this->input->post('url') ? $this->input->post('titulo') : $this->input->post('url');
$contenido->titulo = $this->input->post('titulo');
$contenido->url = url_slug($url, array('transliterate' => true));
$contenido->contenido = $this->input->post('contenido');
$contenido->plantilla = $this->input->post('plantilla');
$contenido->maestro = 1;
$contenido->save();
$contenido->generarVersion();
$this->session->set_flashdata('message', 'Contenido ' . ($contenido_id ? 'actualizado' : 'creado') . ' exitosamente');
$respuesta->validacion = TRUE;
redirect('backend/contenidos/ver/' . $contenido->id);
} catch (Exception $e) {
$respuesta->validacion = FALSE;
$respuesta->errores = "<p class='error'>" . $e . "</p>";
}
} else {
$respuesta->validacion = FALSE;
$respuesta->errores = validation_errors('<p class="error">', '</p>');
}
$data['plantillas'] = get_filenames('application/views/contenido/');
$data['contenido'] = $contenido;
$data['content'] = 'backend/contenidos/form';
$data['title'] = 'Backend - Guardar contenido';
$this->load->view('backend/template', $data);
}
示例7: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update()
{
require_once app_path() . '/includes/url-slug/url_slug.php';
$input = \Request::all();
if (isset($input['title']) && trim($input['title']) == '') {
if (isset($input['name']) && trim($input['name']) != '') {
$input['title'] = trim($input['name']);
}
}
if (isset($input['keywords']) && trim($input['keywords']) == '') {
if (isset($input['name']) && trim($input['name']) != '') {
$input['keywords'] = trim($input['name']);
}
}
if (isset($input['description']) && trim($input['description']) == '') {
if (isset($input['short_text']) && trim($input['short_text']) != '') {
$input['description'] = trim($input['short_text']);
}
}
if ($input['id']) {
if (isset($input['pseudo_url']) && trim($input['pseudo_url']) == '') {
if (isset($input['name']) && trim($input['name']) != '') {
$input['pseudo_url'] = Content::checkURL(url_slug(trim($input['name']), array('transliterate' => true)), $input['id']);
}
} elseif (isset($input['pseudo_url']) && trim($input['pseudo_url']) != '') {
$input['pseudo_url'] = Content::checkURL(url_slug(trim($input['pseudo_url']), array('transliterate' => true)), $input['id']);
}
Content::find($input['id'])->update($input);
} else {
if (isset($input['pseudo_url']) && trim($input['pseudo_url']) == '') {
if (isset($input['name']) && trim($input['name']) != '') {
$input['pseudo_url'] = Content::checkURL(url_slug(trim($input['name']), array('transliterate' => true)), null);
}
} elseif (isset($input['pseudo_url']) && trim($input['pseudo_url']) != '') {
$input['pseudo_url'] = Content::checkURL(url_slug(trim($input['pseudo_url']), array('transliterate' => true)), null);
}
$input = Content::create($input);
}
if (\Input::file() && isset($input['id'])) {
if (\Input::file('image') && \Input::file('image')->isValid()) {
if (in_array(\Input::file('image')->getClientOriginalExtension(), ['jpg', 'jpeg', 'png'])) {
$destinationPath = 'images/content/' . $input['id'];
$extension = \Input::file('image')->getClientOriginalExtension();
$fileName = 'preview' . '.' . $extension;
\Input::file('image')->move($destinationPath, $fileName);
}
}
}
return \Redirect::action('Admin\\ContentController@show', ['id' => $input['id'], $input['tab'], 'type' => $input['type']]);
}
示例8: upload
public function upload()
{
$this->load->library('form_validation');
$this->load->model('Video_model');
$this->output->set_header('Content-Type: application/json; charset=utf-8');
$user = $this->ion_auth->user()->row();
$this->form_validation->set_rules('title', 'Video Title', 'trim|required|min_length[2]|max_length[255]|xss_clean');
$this->form_validation->set_rules('url', 'Video URL', 'trim|required|min_length[2]|max_length[255]|xss_clean');
$this->form_validation->set_rules('description', 'Description', 'trim|min_length[2]|max_length[500]|xss_clean');
$title = $this->input->post('title', TRUE);
$url = $this->input->post('url', TRUE);
$description = $this->input->post('description', TRUE);
$video_id = 0;
$video_source = 0;
if ($this->form_validation->run() === FALSE) {
//validation errors
$output_array = array('validation' => 'error', 'message' => validation_errors('<div class="alert alert-error"><strong>Error!</strong> ', '</div>'));
$this->output->set_output(json_encode($output_array));
} else {
$vimeo = json_decode($this->vimeoCurl($url));
if (isset($vimeo->video_id)) {
$video_id = $vimeo->video_id;
$video_source = 'vimeo';
$video_img = $vimeo->thumbnail_url;
} elseif (preg_match('/^(?:https?:\\/\\/)?(?:www\\.)?youtube\\.com\\/watch\\?(?=.*v=((\\w|-){11}))(?:\\S+)?$/', $url)) {
parse_str(parse_url($url, PHP_URL_QUERY), $my_array_of_vars);
if (!empty($my_array_of_vars['v'])) {
$video_id = $my_array_of_vars['v'];
$video_source = 'youtube';
$video_img = 'http://img.youtube.com/vi/' . $video_id . '/hqdefault.jpg';
}
}
if ($video_id === 0 || $video_source === 0) {
$output_array = array('validation' => 'valid', 'response' => 'error', 'message' => '<div class="alert alert-error">Video Source Not Supported. Only Vimeo and Youtube Links are supported.<br />Ensure there is an http:// or https:// in front of the URL string.</div>');
$this->output->set_output(json_encode($output_array));
} else {
$this->load->library('images');
// Make sure the fileName is unique
if (file_exists(FCPATH . 'asset_uploads/' . $user->username . '/videos/' . url_slug($title) . '.jpg')) {
$fileName = url_slug($title) . '_1';
} else {
$fileName = url_slug($title);
}
$data = array('user_id' => $user->id, 'video_title' => $title, 'video_description' => $description, 'video_source' => $video_source, 'video_id' => $video_id, 'video_url' => url_slug($title), 'video_img' => $fileName . '.jpg', 'upload_date' => time());
$resizeDir = FCPATH . 'asset_uploads/' . $user->username . '/videos/';
$this->images->uploadRemoteFile($video_img, $fileName, 'videos', $user->id);
$this->images->resizeImage($resizeDir, $fileName, 'jpg', '150');
$upload = $this->Video_model->add_video($data);
if (!$upload) {
$output_array = array('validation' => 'valid', 'response' => 'error', 'message' => 'Unable to submit. Please try again');
$this->output->set_output(json_encode($output_array));
} else {
$output_array = array('validation' => 'valid', 'response' => 'success', 'message' => 'Your video has been submitted but is not yet active (pending approval).<br />If approved, your video will be available <a href="' . base_url('videos/' . $user->username . '/' . url_slug($title)) . '">HERE</a>.');
$this->output->set_output(json_encode($output_array));
}
}
}
//validation
}
示例9: getLoadImgFname
function getLoadImgFname($mimeType, $alt = '')
{
if (!empty($alt)) {
$newAlt = url_slug($alt, array('transliterate' => true));
$newAlt = $newAlt . '_';
$newAlt = mb_substr($newAlt, 0, 100);
$newAlt = preg_replace("#_[^_]+#i", '', $newAlt);
//удаление обрезанного слова
$imgName = $newAlt . '_' . mt_rand(100, 999999) . '_' . $this->getImgExtensionFromMType($mimeType);
} else {
$imgName = md5(mt_rand(100, 999999) . '_' . time()) . '_' . $this->getImgExtensionFromMType($mimeType);
}
return $imgName;
}
示例10: edit_echipa
public function edit_echipa($cat, $id, $del_photo = null)
{
if ($del_photo) {
$photo = $this->mysql->get_row('echipa', array('id_echipa' => $id));
if ($photo['photo'] != '' and file_exists($_SERVER['DOCUMENT_ROOT'] . $photo['photo'])) {
unlink($_SERVER['DOCUMENT_ROOT'] . $photo['photo']);
}
}
if ($id) {
$i = 0;
foreach ($cat as $item) {
if ($this->mysql->update('echipa', $item, array('id_echipa' => $id))) {
$this->session->set_flashdata('succes', lang('edit_succes'));
} else {
$this->session->set_flashdata('erorr', lang('edit_erorr'));
}
}
//add log
$this->mysql->logs('edit', 'A editat un membru de echipa', 'admin/echipa_form/0/' . $id);
} else {
$this->session->set_flashdata('erorr', lang('id_erorr'));
}
$ord = $this->mysql->get_row('echipa', array('id_echipa' => $id));
//url
$echipa = $this->mysql->get_row('echipa', array('id_echipa' => $id));
$url = url_slug($echipa['name_ro']);
$url_exists = $this->mysql->get_row('echipa', array('url' => $url, 'id_echipa !=' => $id));
if ($url_exists) {
$url = $url . '_' . $id;
}
$this->mysql->update('echipa', array('url' => $url), array('id_echipa' => $id));
//end url
if ($ord['ord'] == 0) {
$this->mysql->update('echipa', array('ord' => $id), array('id_echipa' => $id));
}
}
示例11: header
header('Content-type: text/plain; charset=utf-8');
// Basic usage
echo "This is an example string. Nothing fancy." . "\n";
echo url_slug("This is an example string. Nothing fancy.") . "\n\n";
// Example using French with unwanted characters ('?)
echo "Qu'en est-il français? Ça marche alors?" . "\n";
echo url_slug("Qu'en est-il français? Ça marche alors?") . "\n\n";
// Example using transliteration
echo "Что делать, если я не хочу, UTF-8?" . "\n";
echo url_slug("Что делать, если я не хочу, UTF-8?", array('transliterate' => true)) . "\n\n";
// Example using transliteration on an unsupported language
echo "מה אם אני לא רוצה UTF-8 תווים?" . "\n";
echo url_slug("מה אם אני לא רוצה UTF-8 תווים?", array('transliterate' => true)) . "\n\n";
// Some other options
echo "This is an Example String. What's Going to Happen to Me?" . "\n";
echo url_slug("This is an Example String. What's Going to Happen to Me?", array('delimiter' => '_', 'limit' => 40, 'lowercase' => false, 'replacements' => array('/\\b(an)\\b/i' => 'a', '/\\b(example)\\b/i' => 'Test')));
/*
Output:
This is an example string. Nothing fancy.
this-is-an-example-string-nothing-fancy
Qu'en est-il français? Ça marche alors?
qu-en-est-il-français-ça-marche-alors
Что делать, если я не хочу, UTF-8?
chto-delat-esli-ya-ne-hochu-utf-8
מה אם אני לא רוצה UTF-8 תווים?
מה-אם-אני-לא-רוצה-utf-8-תווים
示例12: stdClass
include_once "HTML/Template/Flexy.php";
$tpl = new stdClass();
$config = new Configuracion($sql);
$error = true;
$cursor = $sql->readDB("CONTENIDO", "ESTADO__CON='A'");
while ($row = $cursor->fetch_assoc()) {
if (url_slug($row['TITULO__CON']) == substr($_SERVER['REQUEST_URI'], 1)) {
$error = false;
}
if ("contenido=" . $row["ID______CON"] == substr($_SERVER['REQUEST_URI'], 1)) {
$error = false;
}
}
$cursor = $sql->readDB("CATEGORIA");
while ($row = $cursor->fetch_assoc()) {
if (url_slug($row['NOMBRE__CAT']) == substr($_SERVER['REQUEST_URI'], 1)) {
$error = false;
}
}
if (!$error) {
Header("HTTP/1.0 200 OK");
$_REQUEST['bufferedHTML'] = true;
$_REQUEST['what'] = substr($_SERVER['REQUEST_URI'], 1);
include_once "getContent.php";
$content = $retval['html'];
$content .= "<script>var error = true; var passedURL = '" . substr($_SERVER['REQUEST_URI'], 1) . "';</script>";
include_once "container.php";
exit;
}
$options = array('templateDir' => $install . "/template", 'compileDir' => $install . "/tmp");
$object = new HTML_Template_Flexy($options);
示例13: while
$tpl->PREV = true;
}
if ($actual < $total) {
$tpl->NEXT = true;
}
$tpl->TOTAL = $total;
$tpl->ACTUAL = $actual;
$cursor = $sql->readDB("CONTENIDO,CATEGORIA", "ESTADO__CON='A' AND ID______CAT=CATEGORICON", null, "*", ($actual - 1) * $porpagina . "," . $porpagina);
if ($cursor && $cursor->num_rows > 0) {
while ($row = $cursor->fetch_assoc()) {
$group = $row['ID______CAT'];
$key = $row['ID______CON'];
//$cont = new Contenido($row['ID______CON']);
$row['FECHA___CON'] = date('d/m/Y H:i', strtotime($row['FECHA___CON']));
$tpl->CONTENIDO[$group][$key] = $row;
//$cont->getHTML();
}
}
$tpl->CONFIGURACION = array();
$cursor = $sql->readDB("CONFIGURACION");
if ($cursor->num_rows > 0) {
while ($row = $cursor->fetch_assoc()) {
$key = url_slug($row['NOMBRE__CFG']);
$tpl->CONFIGURACION[$key] = $row['VALOR___CFG'];
}
}
$options = array('templateDir' => 'templates', 'compileDir' => 'tmp');
$output = new HTML_Template_Flexy($options);
$output->compile('news.html');
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include "container.php";
示例14: array
$urlsPriority = array();
$base = "http://" . $_SERVER['HTTP_HOST'];
$urls = array();
$urlsPriority[] = $base;
$cursor = $sql->readDB("CATEGORIA", "ESTADO__CAT='A'");
while ($row = $cursor->fetch_assoc()) {
$url = url_slug($row['NOMBRE__CAT']);
if ($row['PADRE___CAT'] == '-1') {
$urlsPriority[] = $base . "/" . $url;
} else {
$urls[] = $base . "/" . $url;
}
}
if ($cursor = $sql->readDB("CONTENIDO", "ESTADO__CON='A'")) {
while ($row = $cursor->fetch_assoc()) {
if (!empty($row['TITULO__CON'])) {
$url = url_slug($row['TITULO__CON']);
} else {
$url = "contenido=" . $row["ID______CON"];
}
$urls[] = $base . "/" . $url;
}
}
$tpl->PRIORITY = $urlsPriority;
$tpl->URLS = $urls;
$tpl->DATE = date(DATE_ATOM);
//*
$output = new HTML_Template_Flexy(array('templateDir' => $install . "/template", 'compileDir' => $install . '/tmp'));
$output->compile("sitemap.xml");
$output->outputObject($tpl);
//*/
示例15: edit_catalog
public function edit_catalog($cat, $id, $del_photo = null, $preturi = null, $preturi_red = null)
{
if ($del_photo) {
$photo = $this->mysql->get_row('catalog', array('id' => $id));
if ($photo['photo'] != '' and file_exists($_SERVER['DOCUMENT_ROOT'] . $photo['photo'])) {
unlink($_SERVER['DOCUMENT_ROOT'] . $photo['photo']);
}
$this->mysql->update('catalog', array('photo_ro' => ''), array('id' => $id));
}
if ($id) {
$i = 0;
foreach ($cat as $item) {
$i++;
if ($this->mysql->update('catalog', $item, array('id' => $id))) {
$this->session->set_flashdata('succes', lang('edit_succes'));
} else {
$this->session->set_flashdata('erorr', lang('edit_erorr'));
}
}
/*echo '<pre>';
print_r($_POST);*/
// foreach ($preturi as $key => $pret) {
// $ex_key = explode('_', $key);
// $pret_id = $this->mysql->update('preturi',array('pret'=>$pret), array('product_id'=>$id,'model_id'=>$ex_key[1]));
// if ($this->mysql->get_row('preturi',array('model_id'=>$ex_key[1],'product_id'=>$id))==false) {
// $this->mysql->insert('preturi',array('pret'=>$pret,'product_id'=>$id,'model_id'=>$ex_key[1],'lungime_id'=>$ex_key[0]));
// }
// }
//
// foreach ($preturi_red as $key => $pret) {
// $ex_key = explode('_', $key);
// $pret_id = $this->mysql->update('preturi',array('pret_red'=>$pret), array('product_id'=>$id,'model_id'=>$ex_key[1]));
// if ($this->mysql->get_row('preturi',array('model_id'=>$ex_key[1],'product_id'=>$id))==false) {
// $this->mysql->insert('preturi',array('pret_red'=>$pret,'product_id'=>$id,'model_id'=>$ex_key[1],'lungime_id'=>$ex_key[0]));
// }
// }
} else {
$this->session->set_flashdata('erorr', lang('id_erorr'));
}
// ord
$ord = $this->mysql->get_row('catalog', array('id' => $id));
if ($ord['ord'] == 0) {
$this->mysql->update('catalog', array('ord' => $id), array('id' => $id));
}
// url
$catalog = $this->mysql->get_row('catalog', array('id' => $id));
$url = url_slug($catalog['name_ro'], array('transliterate' => true, 'delimiter' => '-', 'lowercase' => true));
$url_exists = $this->mysql->get_row('catalog', array('url' => $url, 'id !=' => $id));
if ($url_exists) {
$url = $url . '-' . $id;
}
$this->mysql->update('catalog', array('url' => $url), array('id' => $id));
// end url
}