Forum Moderators: coopster
I've been using this bit of PHP code within my "sidebar.php" file to insert
menu items (external links) depending on what URI is viewed, and and it
works great so far:
<?php
$homepage = "/";
$currentpage = $_SERVER['REQUEST_URI'];
if($homepage==$currentpage) {
include('homepage-only-stuff.php');
}
?>
<?php
$antivirus = "/anti-virus/";
$antivirussub = "/anti-virus/anti-virus-articles.php";
$currentpage = $_SERVER['REQUEST_URI'];
if(($antivirus==$currentpage) ¦¦ ($antivirussub==$currentpage)) {
include('antivirus-only-stuff.php');
}
?>
ETC... (you get the picture :D ) But now I want to exclude my blog pages. I can if I use:
<?php
$homepage = "/weblog/";
$currentpage = $_SERVER['REQUEST_URI'];
if($homepage!=$currentpage) {
include('non-blog-stuff.php');
}
?>
But that does not match all the specific post pages, nor do I want to So, how can I check for /weblog/AnyPostPage-URI/ (as a "wildcard" kind of
match?) and exclude them?
$request = '%^/(.*)/.*%';
$attach = '/$1/$1-articles.php';
$input = $_SERVER['REQUEST_URL'];
preg_replace [uk2.php.net]($request, $attach, $input);