Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
echo file only in certain directory
Old 08-10-2009, 11:44 AM echo file only in certain directory
Banned

Posts: 10
Name: Daniel Leydon
Location: England, Kent, Canterbury
Trades: 0
hi im dan im new here and im a little stuck.

i want to echo some code into the head tag of my site but only on certain pages which are contained in a certain directory

ive had a mess around and nothing ive done seems to do it without an error message so was looking for a bit of help ... cheers im not a php wizzard far from it im just a keen ammatuer :P

here is my code atm

PHP Code:
<?php
$directory 
"getcwd()";
$blogdirectory "/blog/";
 
if (
$directory == $blogdirectory)
echo 
blah blah blah
?>
i only want to include the file or echo the content when its in the blog directory and deeper not in any other directory if the content is echoed in any toher directory it wont find the files and brings upa error message its for a custom wordpress blog

thanks in advance

Dan. DJ Esi

Last edited by Dj-Esi; 08-10-2009 at 12:23 PM..
Dj-Esi is offline
Reply With Quote
View Public Profile Visit Dj-Esi's homepage!
 
 
Register now for full access!
Old 08-12-2009, 03:17 PM Re: echo file only in certain directory
EdB
Skilled Talker

Posts: 79
Name: Ed Barnett
Trades: 0
Hey Dan, try this...

PHP Code:
/* Get the name of the current directory */
$page = array();
$page explode("/"$_SERVER['PHP_SELF']);
$directory_no count($page) - 2;
$directory $page[$directory_no];
define (DIRECTORY$directory);
 
if (
DIRECTORY == 'directoryname') {
  do 
this code rude boy;

__________________

Please login or register to view this content. Registration is FREE
EdB is offline
Reply With Quote
View Public Profile Visit EdB's homepage!
 
Reply     « Reply to echo file only in certain directory
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18562 seconds with 12 queries