| | |
PHP Include ... Quote quirk
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2004
Posts: 2
Reputation:
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
Posts: 282
Reputation:
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]
![]() |
Similar Threads
- <?php include("navigation.php"); ?> (PHP)
- Line is added above php include file (PHP)
- problems with php include (PHP)
- php header include on html? (picture gallery) (PHP)
- Code Snippet: PHP Include Example (PHP)
- PHP's include function ??? (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
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions simple sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube





