User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,050 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,464 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 2597 | Replies: 2
Reply
Join Date: Oct 2004
Posts: 2
Reputation: Hendrinx is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Hendrinx Hendrinx is offline Offline
Newbie Poster

PHP Include ... Quote quirk

  #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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2003
Location: London, England
Posts: 281
Reputation: Roberdin will become famous soon enough Roberdin will become famous soon enough 
Rep Power: 7
Solved Threads: 6
Colleague
Roberdin Roberdin is offline Offline
Supreme Evil Overlord

Re: PHP Include ... Quote quirk

  #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  
Join Date: Oct 2004
Posts: 2
Reputation: Hendrinx is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Hendrinx Hendrinx is offline Offline
Newbie Poster

Re: PHP Include ... Quote quirk

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 11:47 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC