本文整理汇总了PHP中Gdn_Theme::Link方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Theme::Link方法的具体用法?PHP Gdn_Theme::Link怎么用?PHP Gdn_Theme::Link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Theme
的用法示例。
在下文中一共展示了Gdn_Theme::Link方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_link
/**
* Takes a route and prepends the web root (expects "/controller/action/params" as $Path).
*
* @param array The parameters passed into the function.
* The parameters that can be passed to this function are as follows.
* - <b>path</b>: The relative path for the url. There are some special paths that can be used to return "intelligent" links:
* - <b>signinout</b>: This will return a signin/signout url that will toggle depending on whether or not the user is already signed in. When this path is given the text is automaticall set.
* - <b>withdomain</b>: Whether or not to add the domain to the url.
* - <b>text</b>: Html text to be put inside an anchor. If this value is set then an html <a></a> is returned rather than just a url.
* - <b>id, class, etc.</b>: When an anchor is generated then any other attributes are passed through and will be written in the resulting tag.
* @param Smarty The smarty object rendering the template.
* @return The url.
*/
function smarty_function_link($Params, &$Smarty)
{
$Path = GetValue('path', $Params, '', TRUE);
$Text = GetValue('text', $Params, '', TRUE);
$NoTag = GetValue('notag', $Params, FALSE, TRUE);
$CustomFormat = GetValue('format', $Params, FALSE, TRUE);
if (!$Text && $Path != 'signinout' && $Path != 'signin') {
$NoTag = TRUE;
}
if ($CustomFormat) {
$Format = $CustomFormat;
} else {
if ($NoTag) {
$Format = '%url';
} else {
$Format = '<a href="%url" class="%class">%text</a>';
}
}
$Options = array();
if (isset($Params['withdomain'])) {
$Options['WithDomain'] = $Params['withdomain'];
}
if (isset($Params['class'])) {
$Options['class'] = $Params['class'];
}
if (isset($Params['tk'])) {
$Options['TK'] = $Params['tk'];
}
if (isset($Params['target'])) {
$Options['Target'] = $Params['target'];
}
$Result = Gdn_Theme::Link($Path, $Text, $Format, $Options);
return $Result;
}
示例2: smarty_function_signin_link
/**
*/
function smarty_function_signin_link($Params, &$Smarty)
{
if (!Gdn::Session()->IsValid()) {
$Wrap = GetValue('wrap', $Params, 'li');
return Gdn_Theme::Link('signinout', GetValue('text', $Params, ''), GetValue('format', $Params, Wrap('<a href="%url" rel="nofollow" class="%class">%text</a>', $Wrap)), $Params);
}
}
示例3: smarty_function_custom_menu
/**
* A placeholder for future menu items.
*
* @param array The parameters passed into the function. This currently takes no parameters.
* @param Smarty The smarty object rendering the template.
* @return
*/
function smarty_function_custom_menu($Params, &$Smarty)
{
$Controller = $Smarty->Controller;
if (is_object($Menu = GetValue('Menu', $Controller))) {
$Format = GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', GetValue('wrap', $Params, 'li')));
$Result = '';
foreach ($Menu->Items as $Group) {
foreach ($Group as $Item) {
// Make sure the item is a custom item.
if (GetValueR('Attributes.Standard', $Item)) {
continue;
}
// Make sure the user has permission for the item.
if ($Permission = GetValue('Permission', $Item)) {
if (!Gdn::Session()->CheckPermission($Permission)) {
continue;
}
}
if (($Url = GetValue('Url', $Item)) && ($Text = GetValue('Text', $Item))) {
$Result .= Gdn_Theme::Link($Url, $Text, $Format);
}
}
}
return $Result;
}
return '';
}
示例4: smarty_function_nomobile_link
/**
*/
function smarty_function_nomobile_link($Params, &$Smarty)
{
$Path = GetValue('path', $Params, '', TRUE);
$Text = GetValue('text', $Params, '', TRUE);
$Wrap = GetValue('wrap', $Params, 'li');
return Gdn_Theme::Link('profile/nomobile', GetValue('text', $Params, T("Full Site")), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
示例5: smarty_function_category_link
/**
*/
function smarty_function_category_link($Params, &$Smarty)
{
$Path = GetValue('path', $Params, '', TRUE);
$Text = GetValue('text', $Params, '', TRUE);
$Wrap = GetValue('wrap', $Params, 'li');
return Gdn_Theme::Link('category', GetValue('text', $Params, ''), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
示例6: smarty_function_forum_root_link
/**
* Takes a route and prepends the web root (expects "/controller/action/params" as $Path).
*
* @param array The parameters passed into the function.
* The parameters that can be passed to this function are as follows.
* - <b>path</b>: The relative path for the url. There are some special paths that can be used to return "intelligent" links:
* - <b>signinout</b>: This will return a signin/signout url that will toggle depending on whether or not the user is already signed in. When this path is given the text is automaticall set.
* - <b>withdomain</b>: Whether or not to add the domain to the url.
* - <b>text</b>: Html text to be put inside an anchor. If this value is set then an html <a></a> is returned rather than just a url.
* - <b>id, class, etc.></b>: When an anchor is generated then any other attributes are passed through and will be written in the resulting tag.
* @param Smarty The smarty object rendering the template.
* @return The url.
*/
function smarty_function_forum_root_link($Params, &$Smarty)
{
$Text = GetValue('text', $Params, '', TRUE);
$Format = GetValue('format', $Params, '<li><a href="%url" class="%class">%text</a></li>');
$Options = array();
if (isset($Params['class'])) {
$Options['class'] = $Params['class'];
}
$Result = Gdn_Theme::Link('forumroot', $Text, $Format, $Options);
return $Result;
}
示例7: smarty_function_photo_link
/**
*/
function smarty_function_photo_link($Params, &$Smarty)
{
$Wrap = GetValue('wrap', $Params, 'li');
return Gdn_Theme::Link('photo', GetValue('text', $Params, ''), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
示例8: smarty_function_drafts_link
/**
*/
function smarty_function_drafts_link($Params, &$Smarty)
{
$Wrap = GetValue('wrap', $Params, 'li');
return Gdn_Theme::Link('drafts', GetValue('text', $Params, T('My Drafts')), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
示例9: smarty_function_activity_link
/**
*/
function smarty_function_activity_link($Params, &$Smarty)
{
return Gdn_Theme::Link('activity', GetValue('text', $Params, T('Activity')), GetValue('format', $Params, '<li><a href="%url" class="%class">%text</a></li>'));
}
示例10:
echo Gdn_Format::Text($this->Data('MostPlayedGame')->hoursPlayed . ' hrs / ' . $this->Data('MostPlayedGame')->hoursOnRecord) . ' hrs';
?>
</br>
<?php
echo Gdn_Theme::Link('http://steamcommunity.com/profiles/' . $this->Data('SteamProfile')->steamID64 . '/stats/' . $this->Data('MostPlayedGame')->statsName, 'View stats', '<a href="%url" class="%class" target="_blank" >%text</a>');
?>
</dd>
<?php
}
?>
<dt></dt>
<dd><?php
echo Gdn_Theme::Link('http://steamcommunity.com/profiles/' . $this->Data('SteamProfile')->steamID64 . '/games?tab=all', 'View All Games', '<a href="%url" class="%class" target="_blank" >%text</a>');
?>
</dd>
<dt></dt>
<dd><?php
echo Gdn_Theme::Link('http://steamcommunity.com/profiles/' . $this->Data('SteamProfile')->steamID64 . '/wishlist', 'View Wishlist', '<a href="%url" class="%class" target="_blank" >%text</a>');
?>
</dd>
<?php
}
?>
<dt class="SteamUpdated">Updated</dt>
<dd class="SteamUpdated"><?php
echo Gdn_Format::FuzzyTime($this->Data('SteamProfile')->DateRetrieved, TRUE);
?>
</dd>
</dl>
</div>
示例11: Anchor
$CssClass = 'AllCategories';
if (strtolower($Controller->ControllerName) == 'categoriescontroller' && in_array(strtolower($Controller->RequestMethod), array('index', 'all'))) {
$CssClass .= ' Active';
}
echo '<li class="' . $CssClass . '">' . Anchor(Sprite('SpAllCategories') . T('Categories'), '/categories') . '</li> ';
// }
?>
<li class="Discussions<?php
echo strtolower($Controller->ControllerName) == 'discussionscontroller' && strtolower($Controller->RequestMethod) == 'index' ? ' Active' : '';
?>
"><?php
echo Gdn_Theme::Link('forumroot', Sprite('SpDiscussions') . T('Recent Discussions'));
?>
</li>
<li class="Activities"><?php
echo Gdn_Theme::Link('activity', Sprite('SpActivity') . T('Activity'));
?>
</li>
<?php
if ($CountBookmarks > 0 || $Controller->RequestMethod == 'bookmarked') {
?>
<li class="MyBookmarks<?php
echo $Controller->RequestMethod == 'bookmarked' ? ' Active' : '';
?>
"><?php
echo Anchor(Sprite('SpBookmarks') . $Bookmarked, '/discussions/bookmarked');
?>
</li>
<?php
}
if (($CountDiscussions > 0 || $Controller->RequestMethod == 'mine') && C('Vanilla.Discussions.ShowMineTab', TRUE)) {
示例12: Anchor
$CssClass = 'AllCategories';
if (strtolower($Controller->ControllerName) == 'categoriescontroller' && in_array(strtolower($Controller->RequestMethod), array('index', 'all'))) {
$CssClass .= ' Active';
}
echo '<li class="' . $CssClass . '">' . Anchor(Sprite('SpAllCategories') . ' ' . T('All Categories', 'Categories'), '/categories') . '</li> ';
}
?>
<li class="Discussions<?php
echo strtolower($Controller->ControllerName) == 'discussionscontroller' && strtolower($Controller->RequestMethod) == 'index' ? ' Active' : '';
?>
"><?php
echo Gdn_Theme::Link('forumroot', Sprite('SpDiscussions') . ' ' . T('Recent Discussions'));
?>
</li>
<?php
echo Gdn_Theme::Link('activity', Sprite('SpActivity') . ' ' . T('Activity'), '<li class="Activities"><a href="%url" class="%class">%text</a></li>');
?>
<?php
if ($CountBookmarks > 0 || $Controller->RequestMethod == 'bookmarked') {
?>
<li class="MyBookmarks<?php
echo $Controller->RequestMethod == 'bookmarked' ? ' Active' : '';
?>
"><?php
echo Anchor(Sprite('SpBookmarks') . ' ' . $Bookmarked, '/discussions/bookmarked');
?>
</li>
<?php
}
if (($CountDiscussions > 0 || $Controller->RequestMethod == 'mine') && C('Vanilla.Discussions.ShowMineTab', TRUE)) {
?>
示例13: T
into account. Look at CheckPermission for more information.
if (!$Session->CheckPermission('Vanilla.Comment.Add')) {
$CommentOptions['Disabled'] = 'disabled';
$CommentOptions['Value'] = T('You do not have permission to write new comments.');
}
*/
$this->FireEvent('BeforeBodyField');
echo Wrap($this->Form->TextBox('Body', $CommentOptions), 'div', array('class' => 'TextBoxWrapper'));
$this->FireEvent('AfterBodyField');
echo "<div class=\"Buttons\">\n";
$this->FireEvent('BeforeFormButtons');
$CancelText = T('Back to Discussions');
$CancelClass = 'Back';
if (!$NewOrDraft) {
$CancelText = T('Cancel');
$CancelClass = 'MItem Cancel';
}
echo ' ' . Gdn_Theme::Link('forumroot', $CancelText, NULL, array('class' => $CancelClass)) . ' ';
$ButtonOptions = array('class' => 'Button CommentButton');
/*
Caused non-root users to not be able to add comments. Must take categories
into account. Look at CheckPermission for more information.
if (!Gdn::Session()->CheckPermission('Vanilla.Comment.Add'))
$ButtonOptions['Disabled'] = 'disabled';
*/
echo $this->Form->Button($Editing ? 'Save Comment' : 'Post Comment', $ButtonOptions);
$this->FireEvent('AfterFormButtons');
echo "</div>\n";
echo $this->Form->Close();
?>
</div>
示例14: smarty_function_bookmarks_link
/**
*/
function smarty_function_bookmarks_link($Params, &$Smarty)
{
$Wrap = GetValue('wrap', $Params, 'li');
return Gdn_Theme::Link('discussions/bookmarked', GetValue('text', $Params, T('My Bookmarks')), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
示例15: Anchor
$Controller->FireEvent('BeforeDiscussionFilters');
if ($Session->IsValid()) {
// if (C('Vanilla.Categories.ShowTabs')) {
if (C('Vanilla.Categories.Use')) {
$CssClass = 'AllCategories';
if (strtolower($Controller->ControllerName) == 'categoriescontroller' && in_array(strtolower($Controller->RequestMethod), array('index', 'all'))) {
$CssClass .= ' Active';
}
echo '<li class="' . $CssClass . '">' . Anchor(Sprite('SpAllCategories') . ' ' . T('Categories'), '/categories') . '</li> ';
}
?>
<li class="Discussions<?php
echo strtolower($Controller->ControllerName) == 'discussionscontroller' && strtolower($Controller->RequestMethod) == 'index' ? ' Active' : '';
?>
"><?php
echo Gdn_Theme::Link('forumroot', Sprite('SpDiscussions') . ' ' . T('Recent Discussions'));
?>
</li>
<?php
/* Activities are disabled for now echo Gdn_Theme::Link('activity', Sprite('SpActivity').' '.T('Activity'), '<li class="Activities"><a href="%url" class="%class">%text</a></li>'); */
?>
<?php
if ($CountBookmarks > 0 || $Controller->RequestMethod == 'bookmarked') {
?>
<li class="MyBookmarks<?php
echo $Controller->RequestMethod == 'bookmarked' ? ' Active' : '';
?>
"><?php
echo Anchor(Sprite('SpBookmarks') . ' ' . $Bookmarked, '/discussions/bookmarked');
?>
</li>