• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP link_to函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中link_to函数的典型用法代码示例。如果您正苦于以下问题:PHP link_to函数的具体用法?PHP link_to怎么用?PHP link_to使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了link_to函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: adminIndex

 /**
  * Comments index for admin page
  * @return mixed
  */
 public function adminIndex()
 {
     $comments = Comment::with('user', 'likes', 'user')->orderBy('updated_at', 'desc')->paginate();
     return View::make('admin.dicts.list', ['columns' => ['ID', 'Пользователь', 'Текст', 'Пост', 'Лайки', '', ''], 'data' => $comments->transform(function ($comment) {
         return ['id' => $comment->id, 'user' => link_to("admin/users/{$comment->user->id}", $comment->user->name), 'text' => link_to("admin/comments/{$comment->id}/edit", $comment->text), 'post_text' => link_to("admin/posts/{$comment->post_id}/edit", $comment->post->text), 'likes' => $comment->likes->count(), 'edit' => link_to("admin/comments/{$comment->id}/edit", 'редактировать'), 'delete' => link_to("admin/comments/{$comment->id}/delete", 'удалить')];
     }), 'actions' => [['link' => 'admin/comments/delete', 'text' => 'Удалить выбранное']], 'title' => 'Комментарии', 'links' => $comments->links()]);
 }
开发者ID:SenhorBardell,项目名称:yol,代码行数:11,代码来源:CommentsController.php


示例2: forum_breadcrumb

function forum_breadcrumb($params, $options = array())
{
    if (!$params) {
        return;
    }
    $first = true;
    $title = '';
    $id = isset($options['id']) ? $options['id'] : 'forum_navigation';
    $html = '<ul id="' . $id . '">';
    foreach ($params as $step) {
        $separator = $first ? '' : sfConfig::get('app_sfSimpleForumPlugin_breadcrumb_separator', ' » ');
        $first = false;
        $html .= '<li>' . $separator;
        $title .= $separator;
        if (is_array($step)) {
            $html .= link_to($step[0], $step[1]);
            $title .= $step[0];
        } else {
            $html .= $step;
            $title .= $step;
        }
        $html .= '</li>';
    }
    $html .= '</ul>';
    sfContext::getInstance()->getResponse()->setTitle($title);
    return $html;
}
开发者ID:kriswallsmith,项目名称:sfSimpleForumPlugin,代码行数:27,代码来源:sfSimpleForumHelper.php


示例3: getH1Txt

 /**
  * Method to return text for <h1> tag on parts landing page 
  * PRECONDITION: $this->fetchDetails() must be called first.
  */
 public function getH1Txt()
 {
     $sep = sfConfig::get('app_seo_word_sep_h1');
     $cat_crumb = link_to('Busway', '@busway');
     $manuf_crumb = link_to($this->_details['manuf'], "@bu_manuf?manuf_slug={$this->_details['manuf_slug']}");
     return "<strong>{$this->_part_no}</strong> {$sep} {$cat_crumb} {$sep} {$manuf_crumb}";
 }
开发者ID:morganney,项目名称:livewire,代码行数:11,代码来源:BUPart.class.php


示例4: linkToDelete

 public function linkToDelete($object, $params)
 {
     if ($object->isNew()) {
         return '';
     }
     return link_to(__($params['label'], array(), 'sf_admin'), $this->getUrlForAction('delete'), $object, array_merge($params['params'], array('method' => 'delete', 'confirm' => !empty($params['confirm']) ? __($params['confirm'], array(), 'sf_admin') : $params['confirm'])));
 }
开发者ID:anvaya,项目名称:nckids,代码行数:7,代码来源:clientGeneratorHelper.class.php


示例5: getDatatable

 public function getDatatable()
 {
     $query = DB::table('users')->where('users.account_id', '=', Auth::user()->account_id);
     if (!Session::get('show_trash:user')) {
         $query->where('users.deleted_at', '=', null);
     }
     $query->where('users.public_id', '>', 0)->select('users.public_id', 'users.first_name', 'users.last_name', 'users.email', 'users.confirmed', 'users.public_id', 'users.deleted_at');
     return Datatable::query($query)->addColumn('first_name', function ($model) {
         return link_to('users/' . $model->public_id . '/edit', $model->first_name . ' ' . $model->last_name);
     })->addColumn('email', function ($model) {
         return $model->email;
     })->addColumn('confirmed', function ($model) {
         return $model->deleted_at ? trans('texts.deleted') : ($model->confirmed ? trans('texts.active') : trans('texts.pending'));
     })->addColumn('dropdown', function ($model) {
         $actions = '<div class="btn-group tr-action" style="visibility:hidden;">
           <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
             ' . trans('texts.select') . ' <span class="caret"></span>
           </button>
           <ul class="dropdown-menu" role="menu">';
         if ($model->deleted_at) {
             $actions .= '<li><a href="' . URL::to('restore_user/' . $model->public_id) . '">' . uctrans('texts.restore_user') . '</a></li>';
         } else {
             $actions .= '<li><a href="' . URL::to('users/' . $model->public_id) . '/edit">' . uctrans('texts.edit_user') . '</a></li>';
             if (!$model->confirmed) {
                 $actions .= '<li><a href="' . URL::to('send_confirmation/' . $model->public_id) . '">' . uctrans('texts.send_invite') . '</a></li>';
             }
             $actions .= '<li class="divider"></li>
             <li><a href="javascript:deleteUser(' . $model->public_id . ')">' . uctrans('texts.delete_user') . '</a></li>';
         }
         $actions .= '</ul>
       </div>';
         return $actions;
     })->orderColumns(['first_name', 'email', 'confirmed'])->make();
 }
开发者ID:GhDj,项目名称:erp-fac-fin,代码行数:34,代码来源:UserController.php


示例6: op_smt_diary_get_post_image_form

function op_smt_diary_get_post_image_form($diaryImages)
{
    $html = array();
    if (!sfConfig::get('app_diary_is_upload_images')) {
        return $html;
    }
    $html[] = '<table class="file_list">';
    $max = sfConfig::get('app_diary_max_image_file_num', 3);
    for ($i = 1; $i <= $max; $i++) {
        $tagName = 'diary_photo_' . $i;
        $html[] = '<tr>';
        $label = label_for(__('Photo') . $i, $tagName);
        $html[] = content_tag('td', $label, array('class' => 'file_label'));
        $html[] = '<td>';
        if (isset($diaryImages[$i])) {
            $diaryImage = op_api_diary_image($diaryImages[$i], '48x48');
            $html[] = content_tag('p', link_to($diaryImage['imagetag'], $diaryImage['filename'], array('rel' => 'lightbox[image]')));
            $html[] = content_tag('input', '', array('type' => 'checkbox', 'name' => $tagName . '_photo_delete', 'id' => $tagName . '_photo_delete'));
            $html[] = label_for('&nbsp;' . __('remove the current photo'), $tagName . '_photo_delete');
        }
        $attr = array('type' => 'file', 'name' => $tagName, 'id' => $tagName);
        $html[] = content_tag('input', '', $attr);
        $html[] = '</td></tr>';
    }
    $html[] = '</table>';
    return $html;
}
开发者ID:te-koyama,项目名称:openpne,代码行数:27,代码来源:opSmtDiaryHelper.php


示例7: process

 public function process()
 {
     $invoice = $this->invoice();
     $message = trans('texts.' . $invoice->getEntityType()) . ' ' . $invoice->invoice_number;
     $message = link_to('/download/' . $invoice->invitations[0]->invitation_key, $message);
     return SkypeResponse::message($message);
 }
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:7,代码来源:DownloadInvoiceIntent.php


示例8: photo_link_to_add

function photo_link_to_add($entity, $entity_id, $options = array())
{
    // Convert options string to option array
    if (is_string($options)) {
        $options = _convert_string_option($options);
    }
    $label = 'Add photo';
    // CUSTOMIZE LABEL TEXT
    if (isset($options['label'])) {
        $label = $options['label'];
    }
    // ICON
    if (isset($options['icon']) && $options['icon'] == 'true') {
        use_helper('sfIcon');
        $label = icon_tag('image_add') . ' ' . $label;
    }
    $url = "sfPhotoGallery/create?entity={$entity}&entity_id={$entity_id}";
    $url = "@create_photo?entity={$entity}&entity_id={$entity_id}";
    // swicth link to with or without modalBox
    if (isset($options['modalbox']) && $options['modalbox'] == 'true') {
        use_helper('ModalBox');
        return m_link_to($label, $url, array('title' => 'upload photo'));
    } else {
        return link_to($label, $url);
    }
}
开发者ID:sgrove,项目名称:cothinker,代码行数:26,代码来源:sfPhotoGalleryHelper.php


示例9: getDataTable

 /**
  * @return mixed
  */
 public function getDataTable()
 {
     $articles = $this->articlesEntity->select(['id', 'topic', 'created_at', 'updated_at']);
     return Datatables::of($articles)->addColumn('edit', function ($article) {
         return link_to(route('backend.articles.edit', ['articles' => $article->id]), 'Edit', ['data-target-model' => $article->id, 'class' => 'btn btn-xs btn-primary']);
     })->make(true);
 }
开发者ID:muhamadsyahril,项目名称:ecommerce-1,代码行数:10,代码来源:ArticlesController.php


示例10: depp_omnibus_selector

/**
 * Return the HTML code for an unordered list showing opinions that can be voted (no AJAX)
 * If the user has already voted, then a message appears
 * 
 * @param  BaseObject  $object   Propel object instance to vote
 * @param  string      $message  a message string to be displayed in the voting-message block
 * @param  array       $options  Array of HTML options to apply on the HTML list
 * @return string
 **/
function depp_omnibus_selector($object, $message = '', $options = array())
{
    if (is_null($object)) {
        sfLogger::getInstance()->debug('A NULL object cannot be flagged as Omnibus');
        return '';
    }
    $user_id = sfContext::getInstance()->getUser()->getId();
    try {
        $options = _parse_attributes($options);
        if (!isset($options['id'])) {
            $options = array_merge($options, array('id' => 'omnibus-flag'));
        }
        $object_is_omnibus = $object->getIsOmnibus();
        $object_will_be_omnibus = !$object_is_omnibus;
        $selector = '';
        if ($object_is_omnibus) {
            $status = "Questo atto &egrave; Omnibus";
            $label = "Marcalo come non-Omnibus";
        } else {
            $status = "Questo atto non &egrave; Omnibus";
            $label = "Marcalo come Omnibus";
        }
        $selector .= link_to($label, sprintf('atto/setOmnibusStatus?id=%d&status=%d', $object->getId(), $object_will_be_omnibus), array('post' => true));
        return content_tag('div', $status) . content_tag('div', $selector, $options);
    } catch (Exception $e) {
        sfLogger::getInstance()->err('Exception catched from deppOmnibus helper: ' . $e->getMessage());
    }
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:37,代码来源:deppOmnibusHelper.php


示例11: op_activity_body_filter

/**
 * op_activity_body_filter
 *
 * @param Activity $activity
 * @param boolean  $is_auto_link
 * @return string
 */
function op_activity_body_filter($activity, $is_auto_link = true)
{
    $body = $activity->getBody();
    if ($activity->getTemplate()) {
        $config = $activity->getTable()->getTemplateConfig();
        if (!isset($config[$activity->getTemplate()])) {
            return '';
        }
        $params = array();
        foreach ($activity->getTemplateParam() as $key => $value) {
            $params[$key] = $value;
        }
        $body = __($config[$activity->getTemplate()], $params);
        $event = sfContext::getInstance()->getEventDispatcher()->filter(new sfEvent(null, 'op_activity.template.filter_body'), $body);
        $body = $event->getReturnValue();
    }
    $event = sfContext::getInstance()->getEventDispatcher()->filter(new sfEvent(null, 'op_activity.filter_body'), $body);
    $body = $event->getReturnValue();
    if (false === strpos($body, '<a') && $activity->getUri()) {
        return link_to($body, $activity->getUri());
    }
    if ($is_auto_link) {
        if ('mobile_frontend' === sfConfig::get('sf_app')) {
            return op_auto_link_text_for_mobile($body);
        }
        return op_auto_link_text($body);
    }
    return $body;
}
开发者ID:te-koyama,项目名称:openpne,代码行数:36,代码来源:opActivityHelper.php


示例12: link_to_sympal_comment_website

/**
 * Returns the anchor tag to a comment's website
 * 
 * @param   string $url     The url of the website to link to
 * @param   string $label   The text to include inside the link
 * @param   array  $options An array of link options
 * @return  string
 */
function link_to_sympal_comment_website($comment, $options = array())
{
    if (sfSympalConfig::get('sfSympalCommentsPlugin', 'websites_no_follow')) {
        $options['rel'] = 'nofollow';
    }
    return link_to($comment['author_name'], $comment['website'], $options);
}
开发者ID:slemoigne,项目名称:sympal,代码行数:15,代码来源:CommentsHelper.php


示例13: linkToPublish

 public function linkToPublish($object, $params)
 {
     if (!$object->isPublished()) {
         return '<li class="sf_admin_action_publish">' . link_to(__('Publish', array(), 'messages'), 'zsBlogAdmin/ListPublish?id=' . $object->getId(), $object) . '</li>';
     }
     return;
 }
开发者ID:kbond,项目名称:zsBlogPlugin,代码行数:7,代码来源:zsBlogAdminGeneratorHelper.class.php


示例14: getH1Txt

 /**
  * Method to return text for <h1> tag on parts landing page 
  * PRECONDITION: $this->fetchDetails() must be called first.
  */
 public function getH1Txt()
 {
     $sep = sfConfig::get('app_seo_word_sep_h1');
     $cat_crumb = link_to('Circuit Breaker', '@circuit_breakers');
     $manuf_crumb = link_to($this->_details['manuf'], "@cb_manuf?manuf_slug={$this->_details['manuf_slug']}");
     return "<strong>{$this->_part_no}</strong> {$sep} {$cat_crumb} {$sep} {$manuf_crumb}";
 }
开发者ID:morganney,项目名称:livewire,代码行数:11,代码来源:CBPart.class.php


示例15: getDatatableColumns

 protected function getDatatableColumns($entityType, $hideClient)
 {
     return [['vendor_name', function ($model) {
         if ($model->vendor_public_id) {
             return link_to("vendors/{$model->vendor_public_id}", $model->vendor_name);
         } else {
             return '';
         }
     }], ['client_name', function ($model) {
         if ($model->client_public_id) {
             return link_to("clients/{$model->client_public_id}", Utils::getClientDisplayName($model));
         } else {
             return '';
         }
     }], ['expense_date', function ($model) {
         return link_to("expenses/{$model->public_id}/edit", Utils::fromSqlDate($model->expense_date));
     }], ['amount', function ($model) {
         // show both the amount and the converted amount
         if ($model->exchange_rate != 1) {
             $converted = round($model->amount * $model->exchange_rate, 2);
             return Utils::formatMoney($model->amount, $model->expense_currency_id) . ' | ' . Utils::formatMoney($converted, $model->invoice_currency_id);
         } else {
             return Utils::formatMoney($model->amount, $model->expense_currency_id);
         }
     }], ['public_notes', function ($model) {
         return $model->public_notes != null ? substr($model->public_notes, 0, 100) : '';
     }], ['invoice_id', function ($model) {
         return self::getStatusLabel($model->invoice_id, $model->should_be_invoiced);
     }]];
 }
开发者ID:gauravvaidya11,项目名称:invoiceninja,代码行数:30,代码来源:ExpenseService.php


示例16: link_to_post

function link_to_post($post, $text = '', $postfix = null, $options = array())
{
    if (!$text) {
        $text = $post->getTitle();
    }
    return link_to($text, sfSimpleBlogTools::generatePostUri($post, $postfix), $options);
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:7,代码来源:sfSimpleBlogHelper.php


示例17: getDatatable

 public function getDatatable($clientPublicId = null)
 {
     $credits = $this->creditRepo->find($clientPublicId, Input::get('sSearch'));
     $table = Datatable::query($credits);
     if (!$clientPublicId) {
         $table->addColumn('checkbox', function ($model) {
             return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
         })->addColumn('client_name', function ($model) {
             return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model));
         });
     }
     return $table->addColumn('amount', function ($model) {
         return Utils::formatMoney($model->amount, $model->currency_id);
     })->addColumn('balance', function ($model) {
         return Utils::formatMoney($model->balance, $model->currency_id);
     })->addColumn('credit_date', function ($model) {
         return Utils::fromSqlDate($model->credit_date);
     })->addColumn('private_notes', function ($model) {
         return $model->private_notes;
     })->addColumn('dropdown', function ($model) {
         return '<div class="btn-group tr-action" style="visibility:hidden;">
                         <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
                             ' . trans('texts.select') . ' <span class="caret"></span>
                         </button>
                         <ul class="dropdown-menu" role="menu">
                         <li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_credit') . '</a></li>
                         <li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans('texts.delete_credit') . '</a></li>                          
                       </ul>
                     </div>';
     })->make();
 }
开发者ID:poseidonjm,项目名称:invoice-ninja,代码行数:31,代码来源:CreditController.php


示例18: add_to_cart

/**
 * TimpanyHelper.
 *
 * @package    timpany
 * @subpackage helper
 * @author     Thomas Kappel <[email protected]>
 */
function add_to_cart(timpanyProduct $product, $name = null)
{
    if (is_null($name)) {
        $name = $product->getName();
    }
    return link_to($name, '@timpany_cart_add?product=' . $product->getSlug());
}
开发者ID:quafzi,项目名称:timpany-prototype,代码行数:14,代码来源:TimpanyHelper.php


示例19: columns

 public function columns()
 {
     $entityType = $this->entityType;
     return [['invoice_number', function ($model) use($entityType) {
         if (!Auth::user()->can('viewByOwner', [ENTITY_INVOICE, $model->user_id])) {
             return $model->invoice_number;
         }
         return link_to("{$entityType}s/{$model->public_id}/edit", $model->invoice_number, ['class' => Utils::getEntityRowClass($model)])->toHtml();
     }], ['client_name', function ($model) {
         if (!Auth::user()->can('viewByOwner', [ENTITY_CLIENT, $model->client_user_id])) {
             return Utils::getClientDisplayName($model);
         }
         return link_to("clients/{$model->client_public_id}", Utils::getClientDisplayName($model))->toHtml();
     }, !$this->hideClient], ['invoice_date', function ($model) {
         return Utils::fromSqlDate($model->invoice_date);
     }], ['amount', function ($model) {
         return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id);
     }], ['balance', function ($model) {
         return $model->partial > 0 ? trans('texts.partial_remaining', ['partial' => Utils::formatMoney($model->partial, $model->currency_id, $model->country_id), 'balance' => Utils::formatMoney($model->balance, $model->currency_id, $model->country_id)]) : Utils::formatMoney($model->balance, $model->currency_id, $model->country_id);
     }, $entityType == ENTITY_INVOICE], ['due_date', function ($model) {
         return Utils::fromSqlDate($model->due_date);
     }], ['invoice_status_name', function ($model) use($entityType) {
         return $model->quote_invoice_id ? link_to("invoices/{$model->quote_invoice_id}/edit", trans('texts.converted'))->toHtml() : self::getStatusLabel($model);
     }]];
 }
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:25,代码来源:InvoiceDatatable.php


示例20: link_to_course

/**
 * Create an html link to the given course or course tool
 * text and attributes
 * @param   string text
 * @param   string courseId
 * @param   array attributes (optional)
 * @return  string
 */
function link_to_course($text, $courseId, $attributes = null)
{
    $url = get_path('url') . '/claroline/course/index.php?cid=' . $courseId;
    $urlObj = new Url($url);
    $url = $urlObj->toUrl();
    return link_to($text, $url, $attributes);
}
开发者ID:rhertzog,项目名称:lcs,代码行数:15,代码来源:helpers.lib.php



注:本文中的link_to函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP link_to1函数代码示例发布时间:2022-05-15
下一篇:
PHP link_tag函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap