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

2
Contributors
2
Replies
3
Views
12 Years
Discussion Span
Last Post by Hendrinx
0

Yes; you can either do:

include("/home/.sites/88/site213/web/test_server/events1/web/ssi/{$pageName}_secondarynav.htm");

or

include('/home/.sites/88/site213/web/test_server/events1/web/ssi/' .$pageName . '_secondarynav.htm');
0

That is awsome, thanks ever so much. I had tried () but never tried the braces!

Once again cheers

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.