PHP Include ... Quote quirk

Reply

Join Date: Oct 2004
Posts: 2
Reputation: Hendrinx is an unknown quantity at this point 
Solved Threads: 0
Hendrinx Hendrinx is offline Offline
Newbie Poster

PHP Include ... Quote quirk

 
0
  #1
Oct 25th, 2004
First excuse me for posting such a question, I'm sure it has a very simple answer. I am about to get to grips with PHP over the next few months and as such have no real experience.

The problem I'm facing is with passing a variable declared at the top of the page into an include url, it goes something like this:

<?php $pageName = ourservice;?>

<!-- Blah blah blah HTML Etc. -->

<?php include("/home/.sites/88/site213/web/test_server/events1/web/ssi/'$pageName'_secondarynav.htm"); ?>

The include points to a file (in this instance) called 'ourservice'_secondarynav.htm.

Now I want it to point it to ourservice_secondarynav.htm; without single quotes around the ourservice. Is there any other way of containing this variable? Or am I doing this completly wrong?

Cheers peops, much obliged
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 282
Reputation: Roberdin will become famous soon enough Roberdin will become famous soon enough 
Solved Threads: 6
Team Colleague
Roberdin Roberdin is offline Offline
Supreme Evil Overlord

Re: PHP Include ... Quote quirk

 
0
  #2
Oct 25th, 2004
Yes; you can either do:
[php] include("/home/.sites/88/site213/web/test_server/events1/web/ssi/{$pageName}_secondarynav.htm"); [/php] or [php] include('/home/.sites/88/site213/web/test_server/events1/web/ssi/' .$pageName . '_secondarynav.htm'); [/php]
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 2
Reputation: Hendrinx is an unknown quantity at this point 
Solved Threads: 0
Hendrinx Hendrinx is offline Offline
Newbie Poster

Re: PHP Include ... Quote quirk

 
0
  #3
Oct 25th, 2004
That is awsome, thanks ever so much. I had tried () but never tried the braces!

Once again cheers
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC