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

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');

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

Once again cheers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.