Jump to content

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


freakyorkshire
Go to solution Solved by 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

Link to comment
Share on other sites

  • Solution

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

Link to comment
Share on other sites

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

Edited by AbraCadaver
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.