很多站长朋友们都不太清楚phpendif,今天小编就来给大家整理phpendif,希望对各位有所帮助,具体内容如下:
本文目录一览: 1、 PHP中if...endif这种写法是怎么回事呢? 2、 wordpress常用的标签有哪些怎么调用 3、 PHP高手帮忙?哪错了? 4、 菜鸟问题,php中的if then endif 怎么写 5、 php 在什么情况下需要用endif 来结束条件语句 6、 php中,,这三者的关系是什么? PHP中if...endif这种写法是怎么回事呢?这是PHP IF语句的标准写法之一,但是不常用.
你要跟HTML混写 照样得 echo ’html语句’
或者 ?〉 HTML语句 <?php
并不见得可读性好。;
wordpress常用的标签有哪些怎么调用常用的有标题、内容、日志元数据等。
循环介绍
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php endif;?>
· if(have_posts()) – 检查博客是否有日志。
· while(have_posts()) – 如果有日志,那么当博客有日志的时候,执行下面 the_post() 这个函数。
· the_post() – 调用具体的日志来显示。
· endwhile; – 遵照规则 #1,这里用于关闭 while()
· endif; – 关闭 if()
调用标题
<a href=";?php the_permalink() ?>"><?php the_title_attribute(); ?></a>
标题太长了可以用下面的:
<a href=";?php the_permalink() ?>"> <?php echo mb_strimwidth(get_the_title(), 0, 32, '...'); ?></a>
调用内容
3-1、全文调用
<?php the_content(); ?>
3-2、摘要调用
<?php echo mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 200,"……"); ?>
日志元数据
4-1、发布日期
<?php the_time('F d, Y') ?>
<?php the_time('m-d') ?>
<?php the_date_xml()?>
4-2、所属分类
<?php the_category(', ') ?>
4-3、文章标签
<?php the_tags('标签: ', ', ', ''); ?>
4-4、留言数
<?php comments_number('暂无评论', '1条评论', '% 评论' );?>
4-5、更多按钮
<a href=";?php the_permalink() ?>">更多内容</a>
4-6、调用文章作者
<?php the_author_posts_link();?>
最新文章调用:
语法
WP标签:<?php wp_get_archives('type=postbypostlimit=10'); ?>
type=postbypost:按最新文章排列limit:限制文章数量最新10篇调用随机文章:
<?php
global $post;
$postid = $post->ID;
$args = array( 'orderby' => 'rand', 'post__not_in' => array($post->ID), 'showposts' => 10);
$query_posts = new WP_Query();
$query_posts->query($args);
?>
<?php while ($query_posts->have_posts()) : $query_posts->the_post(); ?>
<li><a href=";?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>文章日期存档调用
WP标签:<?php wp_get_archives( 'type=monthly' ); ?>
type=monthly按月份读取
分类目录调用
WP标签:<?php wp_list_cats('sort_column=nameoptioncount=1hierarchical=0'); ?>
hierarchial=0 – 不按照层式结构显示子分类
optioncount=1 – 显示每个分类含有的日志数
sort_column=name – 把分类按字符顺序排列
友情链接调用
<?php wp_list_bookmarks('title_li=categorize=0orderby=randlimit=24'); ?>
元数据调用
注册:<?php wp_register(); ?>
登录:<?php wp_loginout(); ?>
PHP高手帮忙?哪错了?<div id="container">
<?php if(have_post()): ?>
<?php while(have_post()): ?>
<?php the_post(); ?>
<?php the_title(); ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
注意是冒号,不是分号
菜鸟问题,php中的if then endif 怎么写<?php
$message = '我的留言';
?>
<div class="formbox">
<?php if ($message): ?>
<table id="1">
<!--留言发表的table-->
</table>
<?php else: ?>
<table id="2">
<!--发表以后显示留言的table-->
</table>
<?php endif; ?>
</div>
php 在什么情况下需要用endif 来结束条件语句如果用if(条件):开头的话,就得用endif来结束。例如:
$i = 9;
if($i>0):
echo "Hello World!";
endif;
php中,,这三者的关系是什么?就是一般的if……else语句啦,只不过这里除了执行if……else代码外,还会输出对应的尖括号包括的内容。
如:<?php if( $a == 1 ): ?>上午好<?php else: ?>下午好<?php endif; ?>
当$a == 1成立的话会显示上午好,否则显示下午好
关于phpendif的介绍到此就结束了,不知道本篇文章是否对您有帮助呢?如果你还想了解更多此类信息,记得收藏关注本站,我们会不定期更新哦。
查看更多关于phpendif php endif的详细内容...