本文整理汇总了PHP中createUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP createUrl函数的具体用法?PHP createUrl怎么用?PHP createUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createUrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lostpasswd
function lostpasswd()
{
$this->load->library('form_validation');
$this->load->helper('form');
$this->load->library('encrypt');
$this->load->helper('string');
$this->load->model('Adminmodel');
$this->load->library('parser');
$this->load->library('email');
$this->security->init_csrf();
$this->security->csrf_verify();
//validation check
$this->form_validation->set_rules('username', 'Username', 'trim|required|callback_username_check');
$this->form_validation->set_error_delimiters('<li>', '</li>');
if ($this->form_validation->run() == FALSE) {
$inner = array();
$page = array();
$page['content'] = $this->load->view('user/lostpasswd-form', $inner, TRUE);
$this->load->view($this->shellFile, $page);
} else {
$this->Adminmodel->issuePassword($this->input->post('username', TRUE));
header("location: " . base_url() . createUrl("welcome/password_sent/"));
exit;
}
}
示例2: transformCategoryToUrl
function transformCategoryToUrl($categories, $action, $main = false)
{
foreach ($categories as $categoryName) {
if (isset($categoryName['category_name'], $categoryName['category_id'])) {
$urlCategories[] = explode('/', createUrl(array($categoryName['category_name'], $categoryName['category_id'])));
} else {
$urlCategories[] = explode('/', createUrl(array($categoryName['subcategory_name'], $categoryName['subcategory_id'])));
}
}
foreach ($urlCategories as $key => $a) {
if (in_array($action, $a)) {
$exists = true;
if (isset($categories[$key]['category_name']) && $main == false) {
$name = $categories[$key]['category_name'];
} else {
$name = $categories[$key]['subcategory_name'];
}
if (isset($categories[$key]['category_id']) && $main == false) {
$index = $categories[$key]['category_id'];
} else {
$index = $categories[$key]['subcategory_id'];
}
break;
} else {
$index = false;
$name = false;
$exists = false;
}
}
$result['exists'] = $exists;
$result['existingIndex'] = $index;
$result['category_name'] = $name;
return $result;
}
示例3: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate($id)
{
$this->customerData = Customer::model()->findByPk($id);
$model = MagicSpool::model()->findByAttributes(array('cus_id' => getCurCusId()));
$magic_model = new MagicSpoonOptions();
if (!$model) {
$model = new MagicSpool();
$magic_model = new MagicSpoonOptions();
}
DynamicCall::GetEdit1stPdf(getCurCusId());
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['MagicSpool'])) {
$model->attributes = $_POST['MagicSpool'];
$model->one = $_POST['MagicSpool']['one'];
$model->two = $_POST['MagicSpool']['two'];
$model->three = $_POST['MagicSpool']['three'];
$model->four = $_POST['MagicSpool']['four'];
if (Yii::app()->user->isUser()) {
$model->cus_id = $id;
}
if ($model->save()) {
// if (Yii::app()->user->isUser()):
$this->redirect(createUrl('site/menu', array('id' => $id)));
// endif;
// $this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model, 'magic_model' => $magic_model));
}
示例4: init
public function init()
{
if (!is_array($this->items)) {
throw new CException('Wrong options format. Look widget php-doc for help.');
}
$this->items = array(_('Головна') => createUrl('site/index')) + $this->items;
}
示例5: getAllProductsByCategory
function getAllProductsByCategory($id, $db)
{
$stmt = $db->prepare('SELECT ' . 'product_has_category.product_id, ' . 'product_has_category.category_id, ' . 'product_has_subcategory.subcategory_id, ' . 'categories.category_name, ' . 'subcategories.subcategory_name, ' . 'products.product_id, ' . 'products.product_name, ' . 'products.product_description, ' . 'products.product_google_description, ' . 'products.product_image_path, ' . 'products.product_start, ' . 'products.product_end, ' . 'products.product_valence, ' . 'products.product_brand, ' . 'package_has_products.user_has_package_id, ' . 'user_has_packages.package_start, ' . 'user_has_packages.package_end, ' . 'user_has_products.user_id, ' . 'user_has_contacts.contact_id, ' . 'contacts.contact_name, ' . 'contacts.contact_homepage, ' . 'contacts.contact_street, ' . 'contacts.contact_zip, ' . 'contacts.contact_city, ' . 'contacts.contact_latitude, ' . 'contacts.contact_longitude, ' . 'contacts.contact_phone, ' . 'contacts.contact_logo_path, ' . 'contacts.contact_mail, ' . 'products.product_price ' . 'FROM product_has_category ' . 'LEFT JOIN products ON product_has_category.product_id = products.product_id ' . 'LEFT JOIN package_has_products ON package_has_products.product_id = products.product_id ' . 'LEFT JOIN user_has_packages ON user_has_packages.user_has_package_id = package_has_products.user_has_package_id ' . 'LEFT JOIN product_has_subcategory ON product_has_subcategory.product_id = products.product_id ' . 'LEFT JOIN subcategories ON subcategories.subcategory_id = product_has_subcategory.subcategory_id ' . 'LEFT JOIN categories ON categories.category_id = product_has_category.category_id ' . 'LEFT JOIN user_has_products ON user_has_products.product_id = products.product_id ' . 'LEFT JOIN user_has_contacts ON user_has_contacts.user_id = user_has_products.user_id ' . 'LEFT JOIN contacts ON contacts.contact_id = user_has_contacts.contact_id ' . 'WHERE product_has_category.category_id = ' . $id . ' ' . 'AND products.product_status = 1');
if ($stmt !== false) {
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $key => $res) {
$name = createUrl(array($res['product_name']));
$name = str_replace(' ', '-', $name);
$name = explode('/', $name);
$result[$key]['url_string'] = $name[1];
$dateStart = explode(' ', $res['product_start']);
$dateEnd = explode(' ', $res['product_end']);
$dateStart[0] = explode('-', $dateStart[0]);
$dateStart[1] = explode(':', $dateStart[1]);
$dateEnd[0] = explode('-', $dateEnd[0]);
$dateEnd[1] = explode(':', $dateEnd[1]);
$stmpStart = mktime($dateStart[1][0], $dateStart[1][1], $dateStart[1][2], $dateStart[0][1], $dateStart[0][2], $dateStart[0][0]);
$stmpEnd = mktime($dateEnd[1][0], $dateEnd[1][1], $dateEnd[1][2], $dateEnd[0][1], $dateEnd[0][2], $dateEnd[0][0]);
$result[$key]['product_timestamp_start'] = $stmpStart;
$result[$key]['product_timestamp_end'] = $stmpEnd;
}
if (!empty($result)) {
return $result;
} else {
return false;
}
}
return false;
}
示例6: dynamicRedirect
function dynamicRedirect($path, $params = [], $getParamsKeys = [])
{
//If user has specified a custom path for redirection
//If ref is set at current page, you know where you should redirect
if (isset($_GET['red'])) {
switch ($_GET['red']) {
case 'add_book':
$getParamsKeys[] = 'authors';
$path = createUrl('add_book.php', $params, $getParamsKeys);
break;
case 'add_book_cp':
$getParamsKeys[] = 'bid';
$path = createUrl('add_book_cp.php', $params, $getParamsKeys);
break;
case 'profile':
array_push($getParamsKeys, 'uid');
$path = createUrl('profiler.php', $params, $getParamsKeys);
break;
case 'request':
$getParamsKeys[] = 'bcid';
$path = createUrl('request.php', $params, $getParamsKeys);
break;
case 'activity':
$path = createUrl('activity.php', $params, $getParamsKeys);
break;
default:
$path = createUrl($path, $params, $getParamsKeys);
}
header('Location: ' . $path);
die;
}
$path = createUrl($path, $params, $getParamsKeys);
header('Location: ' . $path);
die;
}
示例7: delete
function delete($id = null)
{
if (!$id) {
return false;
}
$this->commonmodel->delete($id, 'franchise_testimonials');
redirect(createUrl('frontend/testimonials'));
}
示例8: createMenuItem
function createMenuItem($pageNumber, $title)
{
$isActiveClass = isset($_GET['page']) && $_GET['page'] == 'page_' . $pageNumber ? ' current-menu-item ' : '';
$currentUrl = createUrl($pageNumber);
$menuItem = '<div class="menu-item ' . $isActiveClass . '">';
$menuItem .= '<a href="' . $currentUrl . '" class="menu-anchor">' . $title . '</a>';
$menuItem .= '</div>';
echo $menuItem;
}
示例9: createTagArray
/**
* Creates an jsTree json array for the given tag
*
* @param string $tag Tag name
* @param boolean $hasChildren If the tag has subtags (children) or not.
* If unsure, set it to "true".
*
* @return array Array to be sent back to the browser as json
*/
function createTagArray($tag, $hasChildren = true)
{
$ar = array('data' => array('title' => $tag, 'attr' => array('href' => createUrl('tags', $tag))), 'attr' => array('rel' => $tag));
if ($hasChildren) {
//jstree needs that to show the arrows
$ar['state'] = 'closed';
}
return $ar;
}
示例10: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate($id)
{
$curUser = Customer::model()->findByPk($id);
$this->customerData = $curUser;
if (empty($curUser->id)) {
throw new CHttpException(403, 'Customer Does\'t exists');
}
// saving current customer to session
Yii::app()->session['last_created_user'] = $curUser->attributes;
//$curUser->selectedCategories;
$model = WorkingWell::model()->findByAttributes(array('cus_id' => $id));
$working_model = new WorkingWellOptions();
if (!$model) {
$model = new WorkingWell();
$working_model = new WorkingWellOptions();
}
if (isset($_GET['editpdf'])) {
setCurCus($id);
DynamicCall::SetEdit1stPdf(getCurCusId());
DynamicCall::loadProducts(getCurCusId());
// DynamicCall::loadMenu(getCurCusId());
$cusApp = CustAppoint::model()->findByAttributes(array('cus_id' => getCurCusId(), 'app_id' => 2));
if ($cusApp) {
$cusApp->status = 1;
$cusApp->save();
}
}
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['WorkingWell'])) {
$model->attributes = $_POST['WorkingWell'];
$model->one = $_POST['WorkingWell']['one'];
$model->two = $_POST['WorkingWell']['two'];
$model->three = $_POST['WorkingWell']['three'];
$model->four = $_POST['WorkingWell']['four'];
if (Yii::app()->user->isUser()) {
$model->cus_id = $id;
}
if ($model->save()) {
// if (Yii::app()->user->isUser()):
$this->redirect(createUrl('MagicSpool/create', array('id' => $id)));
// endif;
// $this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model, 'working_model' => $working_model));
}
示例11: reply
function reply($offset = false)
{
if (!$offset) {
redirect('user/messages');
return false;
}
$this->form_validation->set_rules('message', 'Message', 'trim|required');
if ($this->form_validation->run() == FALSE) {
$messages = $this->messagemodel->getMessagesByUserId($offset);
$inner['allMessages'] = $messages;
$page['content'] = $this->load->view('reply', $inner, TRUE);
$this->load->view($this->default, $page);
} else {
$messages = $this->messagemodel->addReply($offset);
$this->session->set_flashdata('SUCCESS', 'message_deleted');
redirect(createUrl('user/messages/reply/' . $offset));
}
}
示例12: nav
static function nav($clearget = true)
{
$text = (include __DIR__ . '/language/' . Core::$LANGUAGE['lang'] . '.php');
$nav = '<ul class="pagination">';
if (self::$curpage - self::$options['move'] > 1 && self::$options['begin']) {
if (self::$options['begin']) {
$nav .= '<li><a href="' . createUrl(['page' => 1], $clearget) . '">' . $text['begin'] . '</a></li>';
}
if (self::$options['before']) {
$nav .= '<li><a href="' . createUrl(['page' => self::$curpage - self::$options['move'] - 1], $clearget) . '">' . $text['before'] . '</a></li>';
}
if (self::$options['trash']) {
$nav .= '<li><span>...</span></li>';
}
}
for ($i = self::$curpage - self::$options['move']; $i <= self::$curpage + self::$options['move']; ++$i) {
if ($i == self::$curpage) {
$nav .= '<li class="active"><span>' . self::$curpage . '</span></li>';
} elseif ($i > 0 && $i <= self::$pages) {
$nav .= '<li><a href="' . createUrl(['page' => $i], $clearget) . '">' . $i . '</a></li>';
}
}
if (self::$curpage - 1 > 0 && empty(Core::$META['prev'])) {
Core::$META['prev'] = createUrl(['page' => self::$curpage - 1], $clearget);
}
if (self::$curpage + 1 <= self::$pages && empty(Core::$META['next'])) {
Core::$META['next'] = createUrl(['page' => self::$curpage + 1], $clearget);
}
if (self::$curpage + self::$options['move'] < self::$pages) {
if (self::$options['trash']) {
$nav .= '<li><span>...</span></li>';
}
if (self::$options['next']) {
$nav .= '<li><a href="' . createUrl(['page' => self::$curpage + self::$options['move'] + 1], $clearget) . '">' . $text['next'] . '</a></li>';
}
if (self::$options['end']) {
$nav .= '<li><a href="' . createUrl(['page' => self::$pages], $clearget) . '">' . $text['end'] . '</a></li>';
}
}
$nav .= '</ul>';
return $nav;
}
示例13: transformProductNameToUrl
function transformProductNameToUrl($products, $action)
{
foreach ($products as $product) {
$urlProducts[] = explode('/', str_replace(' ', '-', createUrl(array($product['product_name'], $product['product_id']))));
}
foreach ($urlProducts as $key => $a) {
if (in_array($action, $a)) {
$exists = true;
$name = $products[$key]['product_name'];
$index = $key;
break;
} else {
$index = false;
$name = false;
$exists = false;
}
}
$result['exists'] = $exists;
$result['existingIndex'] = $index;
$result['product_name'] = $name;
return $result;
}
示例14: index
function index()
{
$allUrls = array();
$otherPages = array("classified/search", "contactus", "contactus-m", "about", "how-to-use", "terms-and-condition", "privacy-policy", "about-m", "how-to-use-m", "terms-and-condition-m", "privacy-policy-m");
foreach ($otherPages as $page) {
$crDate = date("Y-m-d", strtotime('-3 day'));
$allUrls[] = array("loc" => $page, "priority" => "0.8", "lastmod" => $crDate);
}
$categories = $this->common_model->getCategoryArray();
$cities = getCities();
foreach ($categories as $cat) {
foreach ($cities as $city) {
$allUrls[] = array("loc" => "search/" . $cat['cat_slug'] . "/" . urlencode($city->city_name), "priority" => "0.8", "lastmod" => $crDate);
}
}
/*
$categories = $this->common_model->getCategoryOrderedArray();
foreach ($categories as $category)
{
$crDate = date("Y-m-d",strtotime('-1 day'));
$allUrls[] = array("loc"=>createUrl("category",array($category['category']['cat_id'],$category['category']['cat_name'])),"priority"=>"0.8","lastmod"=>$crDate);
if (isset($category["children"]))
{
foreach ($category["children"] as $cat)
{
$allUrls[] = array("loc"=>"classified/search?category=".urlencode($category['category']['cat_id']."-".@$cat['category']['cat_id']."-"),"priority"=>"0.8","lastmod"=>$crDate);
}
}
}*/
$classifieds = $this->common_model->selectData(CLASSIFIEDAD, "clad_id,clad_title,clad_modified_date", array("clad_active" => 1, "clad_expiry_date >=" => date('Y-m-d H:i:s')), "clad_modified_date", "DESC");
foreach ($classifieds as $classified) {
$time = date("Y-m-d", strtotime($classified->clad_modified_date));
$crDate = $time;
$allUrls[] = array("loc" => createUrl("detail", array($classified->clad_id, $classified->clad_title)), "priority" => "0.8", "lastmod" => $crDate);
}
$data['urls'] = $allUrls;
header("Content-Type: text/xml;charset=iso-8859-1");
$this->load->view("sitemap", $data);
}
示例15: autoActiveAd
public function autoActiveAd()
{
$curDate = date('Y-m-d H:i:s');
$this->db->select('ad.*,u.*');
$this->db->from(CLASSIFIEDAD_AD);
$this->db->join(USER_U, "ad.clad_uid = u.u_id");
$where = 'ad.clad_created_date < "' . date('Y-m-d H:i:s', strtotime('-30 minutes')) . '" AND ad.clad_active=2 AND u.u_active = 1 AND u.u_canpost=1 AND u.u_is_verified=1 AND ad.is_deleted=0';
$this->db->where($where);
$query = $this->db->get();
$result = $query->result();
//echo "<pre>"; print_r($this->db->queries);pr($result,9);exit;
if (!empty($result)) {
foreach ($result as $k => $v) {
$where = 'clad_id = ' . $v->clad_id;
$ret = $this->common_model->updateData(CLASSIFIEDAD, array('clad_active' => 1, 'clad_modified_date' => $curDate), $where);
if ($ret) {
if ($v->u_email != '') {
$Arr = array();
$Arr['name'] = $v->u_fname;
$Arr['ad_title'] = $v->clad_title;
$Arr['siteurl'] = "http://" . $_SERVER['HTTP_HOST'];
$Arr['adUrl'] = createUrl("detail", array($v->clad_id, $v->clad_title));
$Arr['clad_id'] = $v->clad_id;
$Arr['baseurl'] = base_url();
$emailTpl = $this->load->view('email_templates/adLiveSuccessfully', $Arr, true);
//pr($emailTpl,8);
$ret = sendEmail($v->u_email, SUBJECT_NEWADLIVE_USER_NOTIFICATION, $emailTpl, FROM_EMAIL, FROM_NAME);
}
## Send sms to customer who post ad
$phonemsg = AD_APPROVAL_NOTIFICATION;
## take msg content from constant
$phonemsg = str_replace('{clad_id}', "#" . $v->clad_id, $phonemsg);
$response = connectMobile($phonemsg, $v->u_mobile);
$res = json_decode($response->raw_body, true);
}
}
}
}