timopp (User)
Fresh Boarder
Posts: 19
|
|
Link in the about text 2 Years, 4 Months ago
|
Karma: 0
|
|
Dewed,
Well this is embarrassing.
How do I put a text link in the About us section. When I tried a standard href I got php errors.
Thanks
Tim
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
|
|
|
Re:Link in the about text 2 Years, 4 Months ago
|
Karma: 9
|
|
It would be helpful if you mentioned what the error was.. but, the 2 most common causes.. unescaped quotes, and headers already sent.
Unescpaed quotes:
Almost all of the html you see in the browser is assigned to a php variable, and them printed...
Something like
<b>Some text<img src="someimage.jpg"> YAY !</b>
becomes
$html = "<b>Some text<img src=\"someimage.jpg\"> YAY !</b>";
The backslashed quotes are needed to tell PHP this is not the end of the variable, you actually want the quotes printed.
Same is true if the html is assigned with single quote, aka apostrophes.. they'll need escaping too, with backslashes so . . .
<P>I'll be home for Christmas</P>
becomes
$html = '<P>I\'ll be home for Christmas</P>';
Headers already sent errors:
This error is caused by accidentally adding a blank line, or even a space before the first <?php tag at the top of a file, or after the closing ?> at the bottom of a file. The error should indicate which file "output started in", check that file for blank lines/spaces.
|
|
|
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
|
|
|
Re:Link in the about text 2 Years, 4 Months ago
|
Karma: 9
|
|
PS.. Don't be embarrassed. The primary purpose of this site is helping people bend open source scripts to their needs. I'm a self taught PHP coder myself, and that's how I learned, by breaking things and eventually fixing them again.
|
|
|
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
timopp (User)
Fresh Boarder
Posts: 19
|
|
Re:Link in the about text 2 Years, 4 Months ago
|
Karma: 0
|
|
Okay,
So this should work
$html = "About Jonesboro is a product of <a href=\"http://clicksdigital.com\"> clicks|digital.com </a>";
But I get this:
Parse error: syntax error, unexpected T_STRING in /home/timopp/public_html/jdirectory/include/about.php on line 25
Thanks
Tim
I prefer an unexpected G-String though...Kapow!!!!
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
|
|
|
Re:Link in the about text 2 Years, 4 Months ago
|
Karma: 9
|
|
Yes, that should work..
Is the line of code you mention actually line 25 of the file ? Might be best to post a few surrounding lines, the cause of the error might actually be on line 22-23. Just indicate which line is actually #25 in your post.
Also, you might notice some lines start with
$html =
and others have a period in them ...
$html .=
The .= means append..
$html = 'First line<br>';
$html .='Second line';
$html ='Third line ';
echo $html; //; prints only "Third line" because the period was missing and the $html variable contents were overwritten.
|
|
|
|
|
|
|
Last Edit: 2009/09/29 11:34 By Dewed.
|
|
|
|
|
|
The administrator has disabled public write access.
|
timopp (User)
Fresh Boarder
Posts: 19
|
|
Re:Link in the about text 2 Years, 4 Months ago
|
Karma: 0
|
|
Kewl Dewed,
That period got me ( as I suspect many more )
BTW what is the difference in $htmlsrc?
Tim
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
|