本文整理汇总了PHP中getLastPathSegment函数的典型用法代码示例。如果您正苦于以下问题:PHP getLastPathSegment函数的具体用法?PHP getLastPathSegment怎么用?PHP getLastPathSegment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getLastPathSegment函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLastPathSegment
<?php
$slug = getLastPathSegment(get_permalink());
$cat = ucfirst($slug);
?>
<?php
date_default_timezone_set('America/New_York');
$dayToday = date("w");
function phone_format($phone)
{
if (!empty($phone)) {
$phone = preg_replace('/[^0-9]*/', '', $phone);
$areaCode = substr($phone, 0, 3);
$exchange = substr($phone, 3, 3);
$extension = substr($phone, -4);
$phone = '(' . $areaCode . ') ' . $exchange . '-' . $extension;
}
return $phone;
}
?>
<?php
$theDateIs = date("m-d-Y");
/* Temporary until can dates into database */
$breakDates = array("10-28-2013", "11-11-2013", "11-28-2013", "11-29-2013");
$breakMessage = "Hours may vary during the semester break, it is recommended that you call ahead.";
$specialDates = array("11-21-2013");
$specialDatesMessage = "Campus closes at 3 p.m. today for UCF v. Rutgers (Football)";
?>
示例2: getLastPathSegment
</header>
<!-- Ads -->
<div class="row">
<div class="large-8 small-12 columns">
<!-- /6880916/Top-Radio-Top-728-300 -->
<div id='ad-top'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('ad-top'); });
</script>
</div>
</div>
</div>
<br />
<!-- breadcrumbs -->
<?php
$data = getLastPathSegment($_SERVER['REQUEST_URI']);
$crumbString1 = "/" . $data[0] . "/";
if (isset($data[1])) {
$crumbString2 = "/" . $data[0] . "/" . $data[1] . "/";
}
if ($data[0]) {
echo '<div class="row">';
echo '<div class="small-12 columns">';
echo '<ul class="breadcrumbs">';
if (isset($data[1])) {
echo '<li><a href="/">Home</a></li>';
echo "<li><a href={$crumbString1}>{$data['0']}</a></li>";
echo "<li class='current'><a href={$crumbString2}>{$data['1']}</a></li>";
} else {
echo '<li><a href="/">Home</a></li>';
echo "<li class='current'><a href={$crumbString1}>{$data['0']}</a></li>";
示例3: date_default_timezone_set
*
* @package kp
*/
date_default_timezone_set('America/New_York');
$dayToday = date("w");
function getLastPathSegment($url)
{
$path = parse_url($url, PHP_URL_PATH);
$pathTrimmed = trim($path, '/');
$pathTokens = explode('/', $pathTrimmed);
if (substr($path, -1) !== '/') {
array_pop($pathTokens);
}
return end($pathTokens);
}
$pageClass = getLastPathSegment(get_permalink());
?>
<!DOCTYPE html>
<html <?php
language_attributes();
?>
>
<head>
<meta charset="<?php
bloginfo('charset');
?>
">
<meta name="viewport" content="width=device-width, initial-scale=1">
示例4: array
<a href="" class="active">Todas</a>
</li>
<?php
$args_cat = array('orderby' => 'id', 'style' => 'list', 'title_li' => '');
wp_list_categories($args_cat);
?>
</ul>
</div>
</nav>
<section id="index">
<div class="container">
<div id="artigos">
<?php
$args = array('posts_per_page' => 6, 'post_type' => 'post', 'category_name' => getLastPathSegment($_SERVER['REQUEST_URI']));
query_posts($args);
global $count;
$count = 0;
$totalposts = $wp_query->found_posts;
?>
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<div class="artigo <?php
if ($count % 3 == 0) {
echo "first";
}
示例5: array
<ico class="arrow next sprite-next">></ico>
<div class="bullets"></div>
<!--/div-->
</section>
<?php } //endif; ?>
<?php
$args = array(
'posts_per_page' => 10,
'name' => getLastPathSegment($_SERVER['REQUEST_URI'])
);
$pos = strrpos($_SERVER['REQUEST_URI'], "/tags/");
if ($pos > -1) {
$args['name'] = null;
$args['tag'] = getLastPathSegment($_SERVER['REQUEST_URI']);
} else {
$args['tag'] = null;
}
$resultssingle = new WP_Query( $args );
?>
<section id="single">
<div class="container">
<div id="artigos">
<?php if ( $resultssingle->have_posts() ) : while ( $resultssingle->have_posts() ) : $resultssingle->the_post(); ?>
<div class="content_post">
<span class="date">
<span><?php the_time('d') ?></span>
<b class="sprite-monthyear"><?php the_time('F') ?><br><?php the_time('Y') ?></b>
示例6: get_template_directory_uri
<script src="<?php
echo get_template_directory_uri();
?>
/js/image-marker.js"></script>
<script src="<?php
echo get_template_directory_uri();
?>
/js/TweenMax.min.js"></script>
<script src="<?php
echo get_template_directory_uri();
?>
/js/general.js?117"></script>
<?php
$isLoggedIn = FrontUser::isLoggedIn();
if (!$isLoggedIn && strpos(getLastPathSegment($_SERVER['REQUEST_URI']), "cadastre-se") === false && strpos(getLastPathSegment($_SERVER['REQUEST_URI']), "login") === false && $_COOKIE['firsttime'] == "yes") {
?>
<div class="film"></div>
<div class="formnewuser">
<p class="title"> Faça seu cadastro <a href="#" class="closelightbox">X</a></p>
<div class="left">
<?php
if (isset($theme_opts[marisa_call_sign_fd]) && strlen($theme_opts[marisa_call_sign_fd]) > 0) {
echo "<img src='" . $theme_opts[marisa_call_sign_fd] . "' title='' />";
}
?>
</div>
<div class="right">
<div class="text">
<h4>
faça seu cadastro agora e ganhe desconto em produtos exclusivos
示例7: define
<?php
define("page", "page");
get_header();
?>
<section id="page">
<div class="container">
<div id="artigos">
<?php
$argspage = array('post_type' => 'page', 'pagename' => getLastPathSegment($_SERVER['REQUEST_URI']));
//query_posts($args);
$resultspage = new WP_Query($argspage);
?>
<?php
if ($resultspage->have_posts()) {
while ($resultspage->have_posts()) {
$resultspage->the_post();
?>
<div class="pagecontent">
<h1><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h1>
<p><?php
the_content();
?>
</p>