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

PHP excerpt函数代码示例

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

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



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

示例1: categoryContent

function categoryContent($cat, $post_count)
{
    query_posts("posts_per_page={$post_count}&cat={$cat}&orderby=ID");
    ?>
	<ul>
	<?php 
    while (have_posts()) {
        the_post();
        ?>
		<li><a href='<?php 
        the_permalink();
        ?>
'><?php 
        the_title();
        ?>
</a><br>
		<p><?php 
        excerpt(20);
        ?>
</p>
		</li>
	<?php 
    }
    ?>
	</ul>
<?php 
}
开发者ID:realfluid,项目名称:umbaugh,代码行数:27,代码来源:category-content.php


示例2: save

 public function save(PostRequest $request, $forum, $topic, $post = null)
 {
     $url = \DB::transaction(function () use($request, $forum, $topic, $post) {
         // parsing text and store it in cache
         $text = app()->make('Parser\\Post')->parse($request->text);
         // post has been modified...
         if ($post !== null) {
             $this->authorize('update', [$post, $forum]);
             $data = $request->only(['text', 'user_name']) + ['edit_count' => $post->edit_count + 1, 'editor_id' => auth()->id()];
             $post->fill($data)->save();
             $activity = Stream_Update::class;
             // user want to change the subject. we must update topics table
             if ($post->id === $topic->first_post_id) {
                 $path = str_slug($request->get('subject'), '_');
                 $topic->fill($request->all() + ['path' => $path])->save();
                 $this->topic->setTags($topic->id, $request->get('tag', []));
             }
         } else {
             $activity = Stream_Create::class;
             // create new post and assign it to topic. don't worry about the rest: trigger will do the work
             $post = $this->post->create($request->all() + ['user_id' => auth()->id(), 'topic_id' => $topic->id, 'forum_id' => $forum->id, 'ip' => request()->ip(), 'browser' => request()->browser(), 'host' => request()->server('SERVER_NAME')]);
             // get id of users that were mentioned in the text
             $usersId = (new Ref_Login())->grab($text);
             if ($usersId) {
                 app()->make('Alert\\Post\\Login')->with(['users_id' => $usersId, 'sender_id' => auth()->id(), 'sender_name' => $request->get('user_name', auth()->user()->name), 'subject' => excerpt($topic->subject, 48), 'excerpt' => excerpt($text), 'url' => route('forum.topic', [$forum->path, $topic->id, $topic->path], false)])->notify();
             }
         }
         $url = route('forum.topic', [$forum->path, $topic->id, $topic->path], false);
         $url .= '?p=' . $post->id . '#id' . $post->id;
         $object = (new Stream_Post(['url' => $url]))->map($post);
         stream($activity, $object, (new Stream_Topic())->map($topic, $forum));
         return $url;
     });
     return redirect()->to($url);
 }
开发者ID:furious-programming,项目名称:coyote,代码行数:35,代码来源:PostController.php


示例3: doFeed

function doFeed($feed)
{
    $rss = new DOMDocument();
    if ($rss->load($feed)) {
        $feed = array();
        foreach ($rss->getElementsByTagName('item') as $node) {
            $item = array('title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue);
            array_push($feed, $item);
        }
        $limit = 3;
        for ($x = 0; $x < $limit; $x++) {
            $title = str_replace(' & ', ' &amp; ', $feed[$x]['title']);
            $link = $feed[$x]['link'];
            $description = $feed[$x]['desc'];
            $date = date('l, F d, Y', strtotime($feed[$x]['date']));
            echo '
					<article>
						<hgroup>
							<h1><a href="' . $link . '" title="' . $title . '">' . $title . '</a>
							<h2>' . $date . '</h2>
						</hgroup>
						<p>' . excerpt($description) . '</p>
					</article>' . "\r\n";
        }
    } else {
        echo '<p class="none">No posts found!</p>' . "\r\n";
    }
}
开发者ID:kirako,项目名称:portfolio,代码行数:28,代码来源:functions.php


示例4: map

 public function map(Model $microblog)
 {
     $this->id = $microblog->id;
     $this->url = route('microblog.view', [$microblog->id], false);
     $this->displayName = excerpt($microblog->text);
     return $this;
 }
开发者ID:furious-programming,项目名称:coyote,代码行数:7,代码来源:Microblog.php


示例5: map

 /**
  * @param Model $microblog
  * @return $this
  */
 public function map(Model $microblog)
 {
     $this->setMicroblogId($microblog->id);
     $this->setUrl(route('microblog.view', [$microblog->id], false));
     $this->setUserId($microblog->user_id);
     $this->setExcerpt(excerpt($microblog->text));
     return $this;
 }
开发者ID:furious-programming,项目名称:coyote,代码行数:12,代码来源:Microblog.php


示例6: save

 public function save(Request $request)
 {
     $this->validate($request, ['url' => 'required|string', 'metadata' => 'json', 'type_id' => 'integer|exists:flag_types,id', 'text' => 'string']);
     \DB::transaction(function () use($request) {
         $flag = Flag::create($request->all() + ['user_id' => auth()->id()]);
         $object = new Stream_Flag(['id' => $flag->id, 'displayName' => excerpt($request->text)]);
         stream(Stream_Create::class, $object);
     });
 }
开发者ID:furious-programming,项目名称:coyote,代码行数:9,代码来源:FlagController.php


示例7: get_slide_items

function get_slide_items($slide_cat, $count)
{
    global $post;
    $args = array('posts_per_page' => $count, 'cat' => $slide_cat);
    $loop = new WP_Query($args);
    echo "<ul class='slides'>";
    while ($loop->have_posts()) {
        $loop->the_post();
        ?>

	<li>
		
		<?php 
        $thumb_id = get_post_thumbnail_id();
        $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true);
        $thumb_url = $thumb_url_array[0];
        // $thumb = get_post_thumbnail_id();
        // $img_url = wp_get_attachment_url( $thumb,'full' ); //get full URL to image (use "large" or "medium" if the images too big)
        // $image = aq_resize( $img_url, 960, 410, true,true,true ); //resize & crop the image
        ?>
		<?php 
        if ($thumb_url) {
            ?>
			<a href="<?php 
            the_permalink();
            ?>
">  <img src="<?php 
            echo $thumb_url;
            ?>
" alt="<?php 
            the_title();
            ?>
" /> </a>
		<?php 
        }
        ?>
		<div class="flex-caption">
					<h2><a href="<?php 
        the_permalink();
        ?>
">  <?php 
        the_title();
        ?>
 </a></h2>
			  	  	<span> <?php 
        echo excerpt(25);
        ?>
 </span>
  	  	</div>
  	</li>

    <?php 
    }
    echo "</ul>";
    wp_reset_postdata();
}
开发者ID:aIbarrab,项目名称:cbrclub,代码行数:56,代码来源:featured.php


示例8: map

 /**
  * @param Model $topic
  * @param Forum $forum
  * @param string|null $text
  * @return $this
  */
 public function map(Model $topic, Forum $forum, $text = null)
 {
     $this->id = $topic->id;
     $this->url = route('forum.topic', [$forum->path, $topic->id, $topic->path], false);
     $this->displayName = $topic->subject;
     $this->forum = ['name' => $forum->name, 'id' => $forum->id, 'path' => $forum->path];
     if ($text) {
         $this->excerpt = excerpt($text);
     }
     return $this;
 }
开发者ID:furious-programming,项目名称:coyote,代码行数:17,代码来源:Topic.php


示例9: index

 /**
  * @param $id
  * @param Microblog $repository
  * @return $this
  */
 public function index($id, Microblog $repository)
 {
     $microblog = $repository->findOrFail($id);
     $excerpt = excerpt($microblog->text);
     $this->breadcrumb->push('Mikroblog', route('microblog.home'));
     $this->breadcrumb->push($excerpt, route('microblog.view', [$microblog->id]));
     $microblog->text = app()->make('Parser\\Microblog')->parse($microblog->text);
     $parser = app()->make('Parser\\Comment');
     foreach ($microblog->comments as &$comment) {
         $comment->text = $parser->parse($comment->text);
     }
     return parent::view('microblog.view')->with(['microblog' => $microblog, 'excerpt' => $excerpt]);
 }
开发者ID:furious-programming,项目名称:coyote,代码行数:18,代码来源:ViewController.php


示例10: custom_excerpt

function custom_excerpt($length = '', $more_txt = 'Read More')
{
    $default_length = 30;
    if (empty($length)) {
        $excerpt_length = $default_length;
    } else {
        $excerpt_length = $length;
    }
    $excerpt = excerpt($excerpt_length);
    $link = '<a href="' . get_permalink($post->ID) . '" class="more_link">' . $more_txt . '</a>';
    $output = "{$excerpt} {$link}";
    echo wpautop($output, true);
}
开发者ID:rigelstpierre,项目名称:Everlovin-Press,代码行数:13,代码来源:excerpts.php


示例11: bytbil_show_news_feed

function bytbil_show_news_feed($posts, $categories = "")
{
    // set up or arguments for our custom query
    if ($posts == 0) {
        $posts = 10;
    }
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    if ($categories != '' && count($categories) != 0) {
        $query_args = array('tax_query' => array(array('taxonomy' => 'news_categories', 'field' => 'id', 'terms' => $categories)), 'posts_per_page' => $posts, 'paged' => $paged);
    } else {
        $query_args = array('post_type' => 'news', 'posts_per_page' => $posts, 'paged' => $paged);
    }
    // create a new instance of WP_Query
    $the_query = new WP_Query($query_args);
    ?>

    <?php 
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            // run the loop
            ?>
    <article class="news-post">
        <a href="<?php 
            the_permalink();
            ?>
">
            <h2><?php 
            echo the_title();
            ?>
</h2>

            <div class="excerpt">
                <?php 
            echo excerpt(45);
            ?>
            </div>
            <span class="date">Skrivet den: <?php 
            echo get_the_date('Y-m-d');
            ?>
</span>
        </a>
    </article>
<?php 
        }
    }
    wp_reset_query();
}
开发者ID:sebjon-bytbil,项目名称:BB.CMS,代码行数:48,代码来源:bytbilcms-nyheter.php


示例12: portfolio_custom_columns

function portfolio_custom_columns($column)
{
    global $post;
    switch ($column) {
        case "portfolio_desc":
            echo excerpt('25');
            break;
        case "portfolio_category":
            echo get_the_term_list($post->ID, 'portfolio_category', '', ', ', '');
            break;
        case "portfolio_image":
            $custom = get_post_custom();
            the_post_thumbnail('thumb-admin');
            break;
    }
}
开发者ID:robasaad,项目名称:hadi,代码行数:16,代码来源:custom-portfolio.php


示例13: the_title

"><?php 
    the_title();
    ?>
</a></h3>
                                <em class="data-time"><?php 
    the_author_posts_link();
    ?>
<span><?php 
    the_time('j M');
    ?>
</span>, <?php 
    the_time('Y');
    ?>
</em>
                                <p><?php 
    echo excerpt(75);
    ?>
</p>
                                <a class="btn btn-primary" href="<?php 
    the_permalink();
    ?>
">Просмотреть</a>
                            </div>
                        </div>
                    </li>
                <?php 
}
?>

            </ul>
开发者ID:schiz,项目名称:architecture,代码行数:30,代码来源:template-blog-4column.php


示例14: while

    while (have_posts()) {
        the_post();
        ?>

                <!-- blog entry -->
                <article class="search-block">
            
                    <h5><a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_title();
        ?>
</a></h5>
                    <?php 
        echo excerpt('26');
        ?>
                    
                    <div class="search-permalink"><a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_permalink();
        ?>
</a></div>
                    
                    <hr class="gw-divider clearboth" />              
                    
                </article>
                
                <?php 
开发者ID:robasaad,项目名称:hadi,代码行数:31,代码来源:search.php


示例15: rwmb_meta

    ?>
		<?php 
}
?>
		<?php 
$bpxl_status_excerpt_home = rwmb_meta('bpxl_status_excerpt_home', $args = array('type' => 'checkbox'), $post->ID);
if (empty($bpxl_status_excerpt_home)) {
    ?>
			<div class="post-inner">
				<div class="post-content">
					<?php 
    $excerpt_length = $bpxl_goblog_options['bpxl_excerpt_length'];
    if ($bpxl_goblog_options['bpxl_home_content'] == '2') {
        the_content(__('Read More', 'bloompixel'));
    } else {
        echo excerpt($excerpt_length);
        ?>
								<div class="read-more">
									<a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        the_title_attribute();
        ?>
" rel="bookmark"><?php 
        _e('Read More', 'bloompixel');
        ?>
</a>
								</div>		
						<?php 
    }
开发者ID:tccyp001,项目名称:onemore-wordpress,代码行数:31,代码来源:content-status.php


示例16: excerpt

										
										<? } else { ?>
										
										<p><?php echo excerpt(40); ?></p>
										
										<? } ?>
										
										
										<div class="he-view">
										
											<div class="bg a0" data-animate="fadeIn">								
			
												<div class="center-bar">
													<a href="<?php the_permalink(); ?>" aria-hidden="true" class="icon-link a0" data-animate="fadeInUp"></a>
												<a href="https://twitter.com/share?url=<?php the_permalink(); ?>&text=<?php the_title(); ?>&via=<?php get_option('cebo_twitter'); ?>" target="_blank" aria-hidden="true" class="icon-twitter a0" data-animate="fadeInUp"></a>
												<a href="http://www.facebook.com/sharer.php?s= 100&amp;p[title]=<?php the_title(); ?>&amp;p[url]=<?php the_permalink(); ?>&amp;p[images][0]=<?php echo $imgsrc[0]; ?>&amp;p[summary]=<?php echo excerpt(30); ?>" target="_blank" aria-hidden="true" class="icon-facebook a0" data-animate="fadeInUp"></a>
													
												</div>
											</div>
									
										</div>	
									
									</div>
									
								
								
								</div>
								
							</div>
							
							
开发者ID:Vinnica,项目名称:theboxerboston.com,代码行数:28,代码来源:search.php


示例17: the_author

</h3></span>
								</div><!--split-img-->
								<div class="split-text">
									<span class="widget-info"><span class="widget-author"><?php 
                            the_author();
                            ?>
</span> | <?php 
                            the_time(get_option('date_format'));
                            ?>
</span>
									<h2><?php 
                            the_title();
                            ?>
</h2>
									<p><?php 
                            echo excerpt(19);
                            ?>
</p>
								</div><!--split-text-->
								</a>
							</li>
							<?php 
                        }
                    }
                    ?>

						<?php 
                }
                ?>

					</ul>
开发者ID:benquinney,项目名称:WOD-Magazine-Custom-Braxton-theme,代码行数:31,代码来源:page-home.php


示例18: the_title

							
							<?php 
        }
        ?>
								
							</div>

						<div class="fr">
							
							<h3><?php 
        the_title();
        ?>
</h3>

							<p><?php 
        echo excerpt(67);
        ?>
</p>

							<div class="room-list-buttons">

								<a class="button" onclick="_gaq.push(['_link', this.href]);return false;" href="<?php 
        if (get_post_meta($post->ID, 'cebo_booklink', true)) {
            echo get_post_meta($post->ID, 'cebo_booklink', true);
        } else {
            echo get_option('cebo_genbooklink');
        }
        ?>
">Reserve Now</a>
								<!--<a class="button" href="<?php 
        the_permalink();
开发者ID:Vinnica,项目名称:theboxerboston.com,代码行数:30,代码来源:page_rooms.php


示例19: bloginfo

						<?php 
    } else {
        ?>
						<img src="<?php 
        bloginfo('template_url');
        ?>
/assets/img/placeholder-carousel.png" width="700" height="252" alt="placeholder" />
						<?php 
    }
    ?>
						<div class="slide-excerpt">
							<h2><?php 
    the_title();
    ?>
 </h2><span><?php 
    excerpt(12);
    ?>
 </span><a href="<?php 
    the_permalink();
    ?>
">Learn more</a></h2>
						</div>
						
					</li>
					<?php 
}
?>
				</ul>
				<div id="slideshow-pager">&nbsp;</div>
			</div>
			<div class="related">
开发者ID:essl-pvac,项目名称:cihm-relationship-toolkit,代码行数:31,代码来源:index.php


示例20: html

      <p class="search-list-excerpt"><?php 
            echo html($result->description());
            ?>
</p>
      <?php 
        } elseif ($result->excerpt() != '') {
            ?>
      <p class="search-list-excerpt"><?php 
            echo html($result->excerpt());
            ?>
</p>
      <?php 
        } else {
            ?>
      <p class="search-list-excerpt"><?php 
            echo excerpt($result->text());
            ?>
</p>
      <?php 
        }
        ?>

      <p class="search-list-crumb">
        <?php 
        foreach ($result->parents()->flip() as $parent) {
            ?>
<!--
     --><a data-separator="&rsaquo;" href="<?php 
            echo $parent->url();
            ?>
"><?php 
开发者ID:AhoyLemon,项目名称:getkirby.com,代码行数:31,代码来源:docs.index.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP exchange_points函数代码示例发布时间:2022-05-15
下一篇:
PHP exception函数代码示例发布时间: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