当前位置: 首页>>代码示例>>PHP>>正文


PHP AkrecipesFrontendHelper::truncate_text方法代码示例

本文整理汇总了PHP中AkrecipesFrontendHelper::truncate_text方法的典型用法代码示例。如果您正苦于以下问题:PHP AkrecipesFrontendHelper::truncate_text方法的具体用法?PHP AkrecipesFrontendHelper::truncate_text怎么用?PHP AkrecipesFrontendHelper::truncate_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AkrecipesFrontendHelper的用法示例。


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

示例1: _prepareDocument

 /**
  * Prepares the document
  *
  * @return void
  *
  * @throws Exception
  */
 protected function _prepareDocument()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $title = null;
     $this->getUser();
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $menulink = $menu->link;
     }
     //error_log("Active menu -->" . print_r($menu,true));
     if ($menu && strpos($menulink, 'option=com_akrecipes&view=recipesbyuser') !== false) {
         // menu is set and menu is pointing to user page
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
         $title = $this->params->get('page_title', '');
     } else {
         //$this->params->def('page_heading', JText::_('COM_AKRECIPES_DEFAULT_PAGE_TITLE'));
         $this->params->def('page_heading', $this->user->name);
     }
     //error_log("Page Heading = " . $this->params->get('page_heading')) ;
     $sitename = $app->get('sitename');
     if (empty($title) || $title == $sitename) {
         $title = $this->user->name;
     } elseif ($app->get('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
     } elseif ($app->get('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
     }
     if ($this->pagination->pagesCurrent > 1) {
         $this->document->setTitle($this->pagination->getPagesCounter() . ' ' . $title);
     } else {
         $this->document->setTitle($title);
     }
     // now set the meta description
     if ($menu && strpos($menulink, 'option=com_akrecipes&view=recipesbyuser') !== false) {
         $meta_description = $this->params->get('menu-meta_description');
     }
     if (empty($meta_description)) {
         $meta_description = AkrecipesFrontendHelper::truncate_text($this->user->akprofile['aboutme'], 150);
     }
     $metaDescription_prefix = '';
     if ($this->pagination->pagesCurrent > 1) {
         $metaDescription_prefix = $this->pagination->getPagesCounter() . ' for ';
     }
     if (!empty($meta_description)) {
         $this->document->setDescription($metaDescription_prefix . $meta_description);
     }
     if ($this->params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
     }
     if ($this->params->get('robots')) {
         $this->document->setMetadata('robots', $this->params->get('robots'));
     }
     //$this->document->addStylesheet('media/com_akrecipes/css/recipe.css');
 }
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:64,代码来源:view.html.php

示例2: substr

        if (strpos($image, '/') === 0) {
            $image = substr($image, 1);
        }
        $recipe_url = JRoute::_(AkrecipesHelperRoute::getRecipeRoute((int) $item->id, $item->catid));
        ?>

			<a href="<?php 
        echo $recipe_url;
        ?>
	" class="list-group-item">
				<h4 class="list-group-item-heading"><?php 
        echo $item->recipe_name;
        ?>
</h4>
				<p><?php 
        echo AkrecipesFrontendHelper::truncate_text($item->recipe_description, 100, true);
        ?>
</p>
			</a>

		<?php 
    }
    ?>

		</div>

	<?php 
}
?>

开发者ID:rutvikd,项目名称:ak-recipes,代码行数:29,代码来源:blog.php

示例3: _prepareDocument

 /**
  * Prepares the document
  *
  * @return void
  *
  * @throws Exception
  */
 protected function _prepareDocument()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $title = null;
     // Because the application sets a default page title,
     // We need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     } else {
         $this->params->def('page_heading', JText::_('COM_AKRECIPES_DEFAULT_PAGE_TITLE'));
     }
     //$title = $this->params->get('page_title', '');
     $title = $this->item->recipe_name;
     if (empty($title)) {
         $title = $app->get('sitename');
     } elseif ($app->get('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
     } elseif ($app->get('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
     }
     $this->document->setTitle($title);
     // now set the meta description
     $metadesc = $this->item->metadesc;
     // if their is a menu meta, use that
     if ($this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     } elseif ($metadesc) {
         $this->document->setDescription($metadesc);
     } else {
         $metadesc = AkrecipesFrontendHelper::truncate_text($this->item->recipe_description, 150);
         $this->document->setDescription($metadesc);
     }
     if ($this->params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
     }
     if ($this->params->get('robots')) {
         $this->document->setMetadata('robots', $this->params->get('robots'));
     }
     //$this->document->addStylesheet('media/com_akrecipes/css/recipe.css');
     $this->document->addStylesheet('media/com_akrecipes/css/star-rating/star-rating.css');
     $this->document->addStylesheet('media/com_akrecipes/css/star-rating/theme-krajee-fa.css');
     // $this->document->addScript('media/com_akrecipes/js/star-rating/star-rating.js');
     // $this->document->addScript('media/com_akrecipes/js/rating.js');
     // $this->document->addScript('media/com_akrecipes/js/hits.js');
     if ($this->params->get('social_media_optimization')) {
         $this->_prepareSocialMedia();
     }
 }
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:57,代码来源:view.html.php

示例4:

">Edit</a>
					<?php 
    }
    ?>
				<?php 
}
?>
				
				<div class="recipedate">
					<?php 
echo JHTML::_('date', $recipe->publish_up, JText::_('DATE_FORMAT_LC2'));
?>
 </div>
				<div class="recipedescription">
					<p><?php 
echo AkrecipesFrontendHelper::truncate_text($recipe->recipe_description, 300, true);
?>
 </p>
				</div>

				<div class="col-md-12 catBlock">
					<?php 
$caturl = AkrecipesHelperRoute::getCategoryRoute($recipe->catid);
?>
 					<span><i class="fa fa-folder"></i> Published in <a href="<?php 
echo $caturl;
?>
" title="View more recipes in <?php 
echo $recipe->catid_title;
?>
"><?php 
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:default_recipe.php

示例5: DateTime

echo $item->title;
?>
"></img>
					<div class="caption">
						<div class="catBlock">
								<?php 
echo $item->catid_title;
?>
						</div>				
						<h3 itemprop="name" class="recipe_title"><?php 
echo $item->title;
?>
</h3>
						<div class="recipedescription">
							<p itemprop="description"><?php 
echo AkrecipesFrontendHelper::truncate_text($item->intro_text, 150, true);
?>
</p>
						</div>	
						<div class="authorDateBlock">
							<div class="recipe_author" itemprop="author">
								<?php 
echo $item->author;
?>
							</div>
							<?php 
$published_datetime = new DateTime(JHTML::_('date', $item->publish_up, 'Y-m-d H:i:s'));
?>
							
							<div class="recipedate" itemprop="datePublished" content="<?php 
echo $published_datetime->format(DateTime::ISO8601);
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:default_recipe_mobile.php

示例6:

						</h2>
				 		<a href="<?php 
        echo $user_url;
        ?>
">			 							 			
							<img class="img-thumbnail" src="<?php 
        echo $image;
        ?>
" alt="<?php 
        echo $user->name;
        ?>
" />
						</a>
						<div class="caption">
							<p>
								<?php 
        echo AkrecipesFrontendHelper::truncate_text($user->userprofile->akprofile['aboutme'], $params->get('author_profile_limit', 100));
        ?>
							</p>						
						</div>
				 </div>
			</div>
			<?php 
        $count++;
        ?>
		<?php 
    }
    ?>
	</div>
<?php 
}
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:listicle.php

示例7:

    echo $unpublished;
    ?>
</span>

				<?php 
}
?>
				
				<div class="recipedate">
					<?php 
echo JHTML::_('date', $item->publish_up, JText::_('DATE_FORMAT_LC2'));
?>
 </div>
				<div class="articledescription">
					<p><?php 
echo AkrecipesFrontendHelper::truncate_text($item->introtext, 300);
?>
</p>
				</div>

				<div class="col-md-12 catBlock">
					<?php 
$caturl = JRoute::_('index.php?option=com_content&view=category&id=' . $item->catid);
?>
 					<span><i class="fa fa-folder"></i> Published in <a href="<?php 
echo $caturl;
?>
" title="View more articles in <?php 
echo $item->category_title;
?>
"><?php 
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:default_article.php


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