•
•
•
•
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
![]() |
•
•
Join Date: Oct 2004
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
•
•
Join Date: Feb 2003
Location: London, England
Posts: 281
Reputation:
Rep Power: 7
Solved Threads: 6
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]
[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]
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- mysql errors, from submit.php and index.php (PHP)
- PHP's include function ??? (PHP)
- need help with insert.php (PHP)
- PHP Includes + (PHP)
- the difference between include and require (PHP)
Other Threads in the PHP Forum
- Previous Thread: How Can I Pass A PHP Variable From One .php page to another
- Next Thread: automatic type conversion


Linear Mode