本文整理汇总了PHP中_link函数的典型用法代码示例。如果您正苦于以下问题:PHP _link函数的具体用法?PHP _link怎么用?PHP _link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: home
public function home()
{
global $core, $bio;
$v = $this->__(array_merge(w('a r'), _array_keys(w('s'), 0)));
if (!empty($v->a)) {
}
if (!empty($v->r)) {
$sql = 'SELECT *
FROM _objects o, _objects_type t, _bio b, _objects_rel_assoc ra, _objects_rel_type rt
WHERE t.type_alias = ?
AND rt.type_alias = ?
AND o.object_bio = b.bio_id
AND ra.assoc_object = o.object_id
AND ra.assoc_rel_type = rt.type_id
ORDER BY o.object_time
LIMIT ??, ??';
$news = sql_rowset(sql_filter($sql, 'news', $v->r, $v->s, $core->v('objects_per_page')));
$sql = 'SELECT COUNT(object_id) AS total
FROM _objects o, _objects_type t, _objects_rel_assoc ra, _objects_rel_type rt
WHERE t.type_alias = ?
AND rt.type_alias = ?
AND ra.assoc_object = o.object_id
AND ra.assoc_rel_type = rt.type_id';
$news_total = sql_field(sql_filter($sql, 'news', $v->r), 'total', 0);
} else {
$sql = 'SELECT *
FROM _objects o, _objects_type t, _bio b
WHERE t.type_alias = ?
AND o.object_type = t.type_id
AND o.object_bio = b.bio_id
ORDER BY o.object_time
LIMIT ??, ??';
$news = sql_rowset(sql_filter($sql, 'news', $v->s, $core->v('objects_per_page')));
$sql = 'SELECT COUNT(object_id) AS total
FROM _objects o, _objects_type t
WHERE t.type_alias = ?
AND o.object_type = t.type_id';
$news_total = sql_field(sql_filter($sql, 'news'), 'total', 0);
}
foreach ($news as $i => $row) {
if (!$i) {
_style('news', _pagination(_link('news'), 's:%d', $news_total + 1, $core->v('objects_per_page'), $v->s));
}
$_row = array('ID' => $row->object_id, 'BIO' => $row->object_bio, 'SUBJECT' => $row->object_subject, 'CONTENT' => _message($row->object_content), 'TIME' => $bio->format_date($row->object_time));
_style('news.row', array_merge($_row, $this->_profile($row)));
}
$sql = 'SELECT *
FROM _objects_rel_type
ORDER BY type_alias';
$rel_type = sql_rowset($sql);
foreach ($rel_type as $i => $row) {
if (!$i) {
_style('rel_type', array('NEWS_URL' => _link('news')));
}
$row->type_alias = _link('news', array('r' => $row->type_alias));
_style('rel_type.row', $row);
}
return;
}
示例2: home
public function home()
{
global $core, $bio;
$v = $this->__(array_merge(w('r'), _array_keys(w('v'), 0)));
if (!empty($v->v)) {
$sql = 'SELECT *
FROM _objects o, _objects_type t
WHERE o.object_id = ?
AND t.type_alias = ?
AND o.object_type = t.type_id';
$video = sql_rowset(sql_filter($sql, $v->v, 'tv'));
$sql = 'SELECT *
FROM _objects o, _objects_type t, _bio b
WHERE o.object_id <> ?
AND t.type_alias = ?
AND o.object_type = t.type_id
AND o.object_bio = b.bio_id
ORDER BY o.object_time';
$tv_list = sql_rowset(sql_filter($sql, $v->v, 'tv'));
$tv = w();
foreach ($video as $row) {
$tv[] = $row;
}
foreach ($tv_list as $row) {
$tv[] = $row;
}
//_pre($tv, true);
} else {
$sql = 'SELECT *
FROM _objects o, _objects_type t, _bio b
WHERE t.type_alias = ?
AND o.object_type = t.type_id
AND o.object_bio = b.bio_id
ORDER BY o.object_time';
$tv = sql_rowset(sql_filter($sql, 'tv'));
}
foreach ($tv as $i => $row) {
if (!$i) {
_style('tv', array('FIRST_SUBJECT' => $row->object_subject));
}
//$preg = preg_match("^http://(?<domain>([^./]+\\.)*youtube\\.com)(/v/|/watch\\?v=)(?<videoId>[A-Za-z0-9_-]{11})", $row->object_content);
preg_match('#(?<=(?:v|i)=)[a-zA-Z0-9-]+(?=&)|(?<=(?:v|i)\\/)[^&\\n]+|(?<=embed\\/)[^"&\\n]+|(?<=(?:v|i)=)[^&\\n]+|(?<=youtu.be\\/)[^&\\n]+#', $row->object_content, $preg);
$embed = '<iframe width="560" height="315" src="http://www.youtube.com/embed/' . $preg[0] . '" frameborder="0" allowfullscreen></iframe>';
$_row = array('ID' => $row->object_id, 'BIO' => $row->object_bio, 'SUBJECT' => $row->object_subject, 'CONTENT' => $row->object_content, 'VIDEO' => $preg[0], 'EMBED' => !$i ? $embed : '<a href="' . _link('tv', array('v' => $row->object_id)) . '" class="thumbnail"><img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt=""><br /><h5>' . $row->object_subject . '</h5></a>', 'EMBED2' => !$i ? $embed : '<img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt="" width="140" height="140" rel="' . _link('tv', array('v' => $row->object_id)) . '" />', 'EMBED3' => !$i ? $embed : '<a href="' . _link('tv', array('v' => $row->object_id)) . '"><img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt="" width="140" height="140"></a>', 'SPAN' => !$i ? 'span6' : 'span2', 'TIME' => $bio->format_date($row->object_time));
_style('tv.row', array_merge($_row, $this->_profile($row)));
}
$sql = 'SELECT *
FROM _objects_rel_type
ORDER BY type_alias';
$rel_type = sql_rowset($sql);
foreach ($rel_type as $i => $row) {
if (!$i) {
_style('rel_type', array('TV_URL' => _link('tv')));
}
$row->type_alias = _link('tv', array('r' => $row->type_alias));
_style('rel_type.row', $row);
}
return;
}
示例3: _import_news
protected function _import_news()
{
$sql = 'SELECT *
FROM _news
ORDER BY post_time';
$news = _rowset($sql);
foreach ($news as $row) {
$sql_insert = array('type' => 1, 'title' => $row['post_subject'], 'desc' => $row['post_desc'], 'link' => _link('news', $row['news_id']), 'time' => $row['post_time'], 'author' => $row['poster_id']);
sql_put('_reference', prefix('ref', $sql_insert));
}
return $this->e('~OK:' . count($news));
}
示例4: home
public function home()
{
global $core;
$v = $this->__(array('a', 'p' => 0));
if (f($v['a'])) {
$sql = 'SELECT area_id
FROM _reference_area
WHERE area_alias = ?';
if (!_field(sql_filter($sql, $v['a']), 'area_id', 0)) {
_fatal();
}
$sql = 'SELECT COUNT(r.ref_id) AS total
FROM _reference r, _reference_area a
WHERE a.area_alias = ?
AND r.ref_area = a.area_id
ORDER BY r.ref_time DESC';
$ref_total = _field(sql_filter($sql, $v['a']), 'total', 0);
$sql = 'SELECT *
FROM _reference r, _reference_area a
WHERE a.area_alias = ?
AND r.ref_area = a.area_id
ORDER BY r.ref_time DESC
LIMIT ??, ??';
$ref = _rowset(sql_filter($sql, $v['a'], $v['p'], $core->v('ref_pages')));
} else {
$sql = 'SELECT COUNT(ref_id) AS total
FROM _reference
ORDER BY ref_time DESC';
$ref_total = _field($sql, 'total', 0);
$sql = 'SELECT *
FROM _reference r, _reference_area a
WHERE r.ref_area = a.area_id
ORDER BY r.ref_time DESC
LIMIT ??, ??';
$ref = _rowset(sql_filter($sql, $v['p'], $core->v('ref_pages')));
}
if ($v['p'] && $ref_total) {
redirect(_link());
} else {
_style('noref');
}
foreach ($ref as $i => $row) {
if (!$i) {
_style('ref');
}
if ($this->has_plugin($row['ref_content'])) {
$this->parse_plugin($row);
continue;
}
_style('ref.row', _vs(array('id' => $row['ref_id'], 'link' => _link($row['ref_alias']), 'subject' => $row['ref_subject'], 'content' => _message($row['ref_content']), 'time' => _format_date($row['ref_time'])), 'ref'));
}
return;
}
示例5: go
function go($section = 'home', $action = 'index', $extra = '')
{
if (is_array($extra)) {
$i = 1;
$outParams = '&';
foreach ($extra as $item) {
$outParams .= 'param' . $i . '=' . $item . '&';
$i++;
}
} else {
$outParams = $extra;
}
return _link($section, $action, $outParams);
}
示例6: linkToViewPage
public function linkToViewPage($object, $params)
{
try {
$page = $object->getDmPage();
} catch (Exception $e) {
if (sfConfig::get('dm_debug')) {
throw $e;
}
return '';
}
if (!$page) {
return '';
}
return '<li class="sf_admin_action_view_page">' . _link('app:front/' . $page->get('slug'))->title(__($params['title'], array('%1%' => dmString::strtolower(__($this->getModule()->getName()))), $this->getI18nCatalogue()))->text(__($params['label'], array(), 'dm'))->set('.s16.s16_file_html.sf_admin_action')->target('blank') . '</li>';
}
示例7: home
public function home()
{
$now = time();
$sql = 'SELECT *
FROM _contest
WHERE contest_start > ??
AND contest_end < ??
ORDER BY contest_start';
$contest = sql_rowset(sql_filter($sql, $now, $now));
foreach ($contest as $i => $row) {
if (!$i) {
_style('contest');
}
_style('contest.row', array('URL' => _link('contest', $row->contest_alias), 'SUBJECT' => $row->contest_subject, 'END' => _format_date($row->contest_end)));
}
return;
}
示例8: home
public function home()
{
global $core, $bio;
$page = 15;
$today = _htimestamp('md');
_pre($bio->v('is_bio'), true);
_style('status_post');
// Friends birthday
if ($bio->v('auth_member')) {
$sql = "SELECT bio_id, bio_alias, bio_name\r\n\t\t\t\tFROM _bio\r\n\t\t\t\tWHERE bio_id IN (\r\n\t\t\t\t\t\tSELECT fan_of\r\n\t\t\t\t\t\tFROM _bio_fans\r\n\t\t\t\t\t\tWHERE fan_assoc = ?\r\n\t\t\t\t\t)\r\n\t\t\t\t\tAND bio_active = ?\r\n\t\t\t\t\tAND bio_birth LIKE '%??'\r\n\t\t\t\tORDER BY bio_name";
$birthday = _rowset(sql_filter($sql, $bio->v('bio_id'), 1, $today));
} else {
$sql = "SELECT bio_id, bio_alias, bio_name, bio_avatar, bio_avatar_up\r\n\t\t\t\tFROM _bio\r\n\t\t\t\tWHERE bio_level = ?\r\n\t\t\t\t\tAND bio_birth LIKE '%??'\r\n\t\t\t\tORDER BY bio_name";
$birthday = _rowset(sql_filter($sql, 1, $today));
}
foreach ($birthday as $i => $row) {
if (!$i) {
_style('birthday');
}
_style('birthday.row', array('A' => _a($row), 'NAME' => $row['bio_name'], 'AVATAR' => _avatar($row)));
}
// Board topics
if ($bio->v('auth_member')) {
$sql = 'SELECT t.topic_id, t.topic_alias, t.topic_title, h.highlight_class
FROM _board_topics t
INNER JOIN _board_forums f ON f.forum_id = t.topic_forum
LEFT JOIN _board_highlight h ON t.topic_highlight = h.highlight_id
RIGHT JOIN _board_disallow d ON t.topic_id = d.disallow_topic AND d.disallow_bio = ?
WHERE t.topic_show = ?
ORDER BY t.topic_shine DESC, t.topic_time DESC
LIMIT ??';
$topics = _rowset(sql_filter($sql, $bio->v('bio_id'), 1, 10));
} else {
$sql = 'SELECT t.topic_id, t.topic_alias, t.topic_title, h.highlight_class
FROM _board_topics t
INNER JOIN _board_forums f ON f.forum_id = t.topic_forum
LEFT JOIN _board_highlight h ON t.topic_highlight = h.highlight_id
WHERE t.topic_show = ?
ORDER BY t.topic_shine DESC, t.topic_time DESC
LIMIT ??';
$topics = _rowset(sql_filter($sql, 1, 10));
}
foreach ($topics as $i => $row) {
if (!$i) {
_style('board_topics');
}
_style('board_topics.row', _vs(array('ID' => $row['topic_id'], 'TITLE' => $row['topic_title'], 'CLASS' => $row['highlight_class']), 'TOPIC'));
}
if ($bio->v('auth_member')) {
// Messages
$sql = 'SELECT *
FROM _bio_messages
INNER JOIN _bio ON message_from = bio_id
INNER JOIN _bio_messages_type ON message_type = type_id
WHERE message_to = ?
AND message_active = ?
ORDER BY message_time DESC';
$messages = _rowset(sql_filter($sql, $bio->v('bio_id'), 1));
foreach ($messages as $i => $row) {
if (!$i) {
_style('messages');
}
_style('messages.row', array('U_MESSAGE' => _link(), '' => ''));
}
// Friend requests
$sql = 'SELECT b.bio_alias, b.bio_name
FROM _bio_friends
INNER JOIN _bio ON friend_assoc = bio_id
WHERE friend_bio = ?
AND friend_pending = ?
ORDER BY friend_time DESC';
$requests = _rowset(sql_filter($sql, $bio->v('bio_id'), 1));
foreach ($requests as $i => $row) {
if (!$i) {
_style('friend_request');
}
_style('friend_request.row', array('U_APPROVE' => _link('home', array('x1' => 'friend', 'x2' => 'approve', 'a' => $row['bio_alias'])), 'U_DENY' => _link('home', array('x1' => 'friend', 'x2' => 'deny', 'a' => $row['bio_alias'])), 'A' => _a($row), 'BIO_NAME' => $row['bio_name']));
}
}
// Banners
$this->announce('home');
return;
}
示例9: _open
<?php
// Vars: $categoryPager
echo $categoryPager->renderNavigationTop();
echo _open('ul.elements');
foreach ($categoryPager as $category) {
echo _open('li.element');
echo _link($category);
echo _close('li');
}
echo _close('ul');
echo $categoryPager->renderNavigationBottom();
示例10: _inc
<?php
TPL::thing('head', 'css', 'http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.1/summernote.css');
_inc("parts/header");
?>
<h1>Adauga > Pagina de Produs</h1>
<hr>
<form class="form-horizontal" role="form" method="post" action="<?php
_link("admin_pages_add", "page_poli_products");
?>
" enctype="multipart/form-data">
<?php
_inc("parts/messages");
?>
<div class="form-group">
<label class="control-label col-sm-2" for="produs_denumire">Denumire produs:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="produs_denumire" name="produs_denumire" placeholder="Introduceti denumirea produsului" value="<?php
_post("produs_denumire");
?>
">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="produs_imagini">Imagini:</label>
<div class="col-sm-6">
<input type="file" id="produs_imagini" name="produs_imagini[]" class="form-control" value="<?php
_post("produs_imagini");
示例11: lime_test
$helper->boot('front');
$t = new lime_test(47);
dm::loadHelpers(array('Dm'));
sfConfig::set('sf_no_script_name', false);
dmDb::table('DmPage')->checkBasicPages();
$sc = $helper->get('service_container');
$sc->mergeParameter('link_tag_record.options', array('current_span' => false))->mergeParameter('link_tag_page.options', array('current_span' => false));
$t->diag('link current_span is false');
$home = dmDb::table('DmPage')->getTree()->fetchRoot();
$helper->get('context')->setPage($home);
$t->diag($home->name . ' is the current page');
$testPage = dmDb::create('DmPage', array('module' => 'main', 'action' => 'test' . dmString::random(12), 'name' => 'I am a root child', 'slug' => dmString::random()));
$testPage->Node->insertAsLastChildOf($home);
$scriptName = $helper->get('request')->getScriptName();
$t->diag('Current cli script name = ' . $scriptName);
$t->is((string) _link('http://c2.com/cgi/wiki?DontRepeatYourself')->text('DRY'), $expected = '<a class="link" href="http://c2.com/cgi/wiki?DontRepeatYourself">DRY</a>', $expected);
$t->like(£link()->render(), '|<a class="link dm_current|', '£link() has class dm_current');
$t->like(£link()->set('current_class', 'my_current')->render(), '|<a class="link my_current|', '£link() has class my_current');
$t->is((string) £link($home), (string) £link(), '£link($home) is £link()');
$t->is((string) £link('@homepage'), (string) £link($home), '£link("@homepage") is £link()');
$t->is((string) £link('main/root'), (string) £link($home), '£link("main/root") is £link()');
$t->is(£link()->getHref(), $scriptName, 'root href is ' . $scriptName);
$t->is(£link()->getText(), $home->name, 'root link text is ' . $home->name);
$expected = $helper->get('controller')->genUrl('dmAuth/signin');
$t->is(£link('+/dmAuth/signin')->getHref(), $expected, '+/dmAuth/signin href is ' . $expected);
$rootLink = sprintf('<a class="%s" href="%s">%s</a>', 'link dm_current', $scriptName, $home->name);
$t->is((string) £link(), $rootLink, 'root link is ' . $rootLink);
$rootLink = sprintf('<a class="%s" href="%s">%s</a>', 'link dm_current', $scriptName, $home->name);
$t->is((string) $helper->get('helper')->link(), $rootLink, 'use the helper service : root link is ' . $rootLink);
$hrefWithParam = $scriptName . '?var=val&other=value';
$t->is((string) £link()->param('var', 'val')->param('other', 'value')->getHref(), $hrefWithParam, $hrefWithParam);
示例12: _open
<?php
echo _open('div.dm.dm_auth.unsupported_browser');
echo _tag('h1.site_name', dmConfig::get('site_name'));
echo _tag('div.message', _tag('p.dm_browser_unsupported.mt10', __("Sorry, it looks like you're using a browser that isn't supported.")) . _tag('p.dm_browser_suggestion.mt10', __("We suggest that you use one of these browsers:")) . _tag('div.dm_suggested_browsers.clearfix', _link('http://www.mozilla.com/firefox/')->text(_media('dmCore/images/64/firefox.png')->size(64, 64) . 'Firefox') . _link('http://www.google.com/chrome')->text(_media('dmCore/images/64/chrome.png')->size(64, 64) . 'Chrome') . _link('http://www.apple.com/safari/')->text(_media('dmCore/images/64/safari.png')->size(64, 64) . 'Safari') . _link('http://www.opera.com/browser/')->text(_media('dmCore/images/64/opera.png')->size(64, 64) . 'Opera')) . _tag('div.dm_skip_browser_detection', _link('@signin?skip_browser_detection=1')->text(__('Or continue at your own peril'))));
echo _close('div');
echo _link('http://diem-project.org/')->text('Diem CMF CMS for symfony')->set('.generator_link');
示例13: _open
<?php
// Vars: $productPager
echo $productPager->renderNavigationTop();
echo _open('div.catalog');
foreach ($productPager as $product) {
if ($product->is_in_action) {
echo _open('div.product');
echo _tag('div.title', _link($product));
echo _tag('div.picture', _link($product)->text(_media($product->Photo)->size(80, 80)));
echo _tag('div.description', $product->description);
echo _tag('div.price', 'old price: ' . _tag('strike', round($product->price)));
echo _tag('div.price', 'new price: ' . _tag('span.new_price', round($product->price_action)));
echo _link('+/product/add_to_cart?id=' . $product->id)->text('add to cart');
} else {
echo _open('div.product');
echo _tag('div.title', _link($product));
echo _tag('div.picture', _link($product)->text(_media($product->Photo)->size(80, 80)));
echo _tag('div.description', $product->description);
echo _tag('div.price', 'price: ' . _tag('span.new_price', round($product->price_action)));
echo _link('+/product/add_to_cart?id=' . $product->id)->text('add to cart');
}
echo _close('div');
// cat_good
}
echo _close('div');
// catalog
echo $productPager->renderNavigationBottom();
示例14: _open
<?php
/*
* An $item is an array containing:
* - title: title of the feed item
* - link: url of the feed item
* - content: HTML content
* - pub_date: item publication date (timestamp)
* - author_name: author name
* - author_link: author link
* - author_email: author email
*/
echo _open('ul');
foreach ($items as $item) {
echo _tag('li', _link($item['link'])->text($item['title'])->set('.feed_item_link') . _tag('div.feed_item_content', dmString::truncate(strip_tags($item['content']), 100)));
}
echo _close('ul');
示例15: _open
<?php
// Dm test domain : Show
// Vars : $dmTestDomain
echo _open('div.dm_test_domain.show');
echo _tag('h1', $dmTestDomain);
echo _open('ul');
foreach ($dmTestDomain->getTags() as $tag) {
echo _tag('li', _link($tag));
}
echo _close('ul');
echo _open('ul');
foreach ($dmTestDomain->getRelatedRecords() as $domain) {
echo _tag('li', _link($domain));
}
echo _close('ul');
echo _close('div');