Jump to content

How to add a hyperlink or a picture to php variable file


freakyorkshire

Recommended Posts

Hi im trying to add a hyperlink or a picture to php variable file, please could someone tell me if possible and how to or help with terminology and point me to a reference.

 

The mainpage index.php has a reference

<div id="subtitle2content">

<p><?php echo $pagesubtitle2content ?></p>

</div>

the file variables.php has a reference

$pagesubtitle2content='More on essays in this example text';

This works well but when I try and add a picture or a hyperlink around the word sample it breaks the page im trying to change until I return to text only

 

Maybe ive just got the syntax wrong but i cant work out what to search for on Google.  Ive tried "using hyperlinks in php variable reference files" but it doesnt give me anything useful - Is this what I am dealing with? A PHP variable reference file?

 

Thanks

Hi I managed to do this with

 

 

$pagesubtitle2content='<a href="www.google.com">More on essays in this example text</a><img src="img/1.png">';

 

would be interested in what you could help with on the question - Is this what I am dealing with? A PHP variable reference file?

 

Thanks

I'm not sure if there's really a name for it.  It's just a file with variables that is included into another file that uses those variables.  You could just as easily have those variables in the same file as the echo.  This just makes it more flexible and possibly modular.

 

Most likely you're running into a quoting problem.  Different quotes have different rules and purposes.  Check here, especially the single and double sections: http://us2.php.net/manual/en/language.types.string.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.