spindrift
-
Posts
7 -
Joined
-
Last visited
Never
Posts posted by spindrift
-
-
hi wildteen88,
that's great, thank you so much for that!
the code works fine for loading files from the _root directory but when it needs to pull something from the /news/ folder, i get the following error message...
Fatal error: Call to undefined function: file_exisits() in /var/www/html/clients/npr/main.php on line 40
...that line of syntax is... [code]elseif(file_exisits('./news/' . $filename . '.php'))
{
include './news/' . $pagename . '.php';
}
// if it couldn't be found display message
else
{
echo $pagename . '.php could not be found in either the root folder or the news folder!';
}[/code]
do you by any chance know why this could be happening? i've tried a few small things like taking out the full-stop infront of ('./news/' etc. but to no avail unfortunately.
thank you very much once again and i'd be grateful if you could get back to me at some point please.
all the best,
mark -
[!--quoteo(post=378676:date=May 31 2006, 07:05 AM:name=Orio)--][div class=\'quotetop\']QUOTE(Orio @ May 31 2006, 07:05 AM) [snapback]378676[/snapback][/div][div class=\'quotemain\'][!--quotec--]
First question:
[code]<?php
$file=$pagename;
$file.=".php"
@require_once ($file);[/code]
I didnt really understand the second question... The file is either in root folder or in /news/ ? Or is it in both?
Orio.
[/quote]
Hi Orio and Andy,
Many thanks for the replies - much appreciated.
The file will be in either the _root folder or in /news/. Do you know how I could code it?
Many thanks and hope to hear back from you.
All the best,
Mark -
Hello!
I have this code in template.php...
[code]<?php @ require_once ("$pagename.php"); ?>[/code]
...to bring content into the template.
I've got a folder called 'news' for all the news articles so how could I edit the code to say 'look for files in the news folder as well as the current folder'?
I guess I would need something like:
[code]<?php @ require_once ("$pagename.php" or "news/$pagename.php"); ?>[/code]
...but that doesn't work. How would I change it to work?
Thank you very much and hope to hear from you.
Mark -
hi andy,
thanks for that and for getting back to me...
i put the code in my template file next to [code]<?php @ require_once ("$pagename.php"); ?>[/code] but it didn't work.
basically what i am after is <?php @ require_once ("$pagename.php" or news/$pagename.php); ?> but i wouldn't know how to write it properly. do you know how it should be written properly?
thank you very much for everything.
all the best,
mark -
hi andyb,
many thanks for the reply.
ill be honest and say i'm new to php and don't really understand all the code in the manual - let alone how to edit it for my needs!
is there a simpler way where the script i posted can search in the news folder? if so, could i be a pain and ask if you would mind telling me the code i need please?
thank you very much once again and i hope to hear from you.
mark
-
Hi guys,
I'm using the below code to call content into my websites' layout:
[code]<?php @ require_once ("$pagename.php"); ?>[/code]
At the moment, I believe it will only search for files in the same folder as my main template which is fine.
The thing is though, is that I want to put all the news files in a folder called 'news'. Is there a way that this code can be edited so it can not only search for and include files in the same folder but also news/ ?
Thank you very much and I hope to hear from you.
All the best,
Mark
How can I write this short/simple bit of php so it will work?
in PHP Coding Help
Posted
thanks for that - boy, do i look stupid!
i've corrected the typo but now everytime it tries to call something from the /news/ folder, it always come up with a message saying "060308.php could not be found in either the root folder or the news folder!".
i've checked that 060308.php is definately in /news/ so i don't understand it. Does any of you guys have any suggestions at all?
thanks again for all your help.
mark