Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-08-01 01:24:47

xjosie729
Member
From: Framingham, MA
Registered: 2006-07-22
Posts: 39
Website

HTML does not work withing PHP

I used the Txp code for inserting php into a page, and it worked, but when I try to include HTML tags in it, nothing show up…


Josie

Offline

#2 2006-08-01 02:36:15

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: HTML does not work withing PHP

Please see the FAQ.

There’s also lots of general information about diagnosing problems and asking for help on the forum.


Alex

Offline

#3 2006-08-01 15:33:02

xjosie729
Member
From: Framingham, MA
Registered: 2006-07-22
Posts: 39
Website

Re: HTML does not work withing PHP

The FAQ didn’t help much.

What I’m saying is that when I use

<txp:php>
echo "hi";
</txp:php>

It displays the word hi.
Today I found that it works when I do this:

<txp:php>
echo "<strong>hi</strong>";
</txp:php>

But for the following code (copied from About.com) nothing shows up.

<txp:php>
//By Angela Bradley for PHP @ About.com


//Assign the image and link URLs here, you can add more following this formatt

$Img1 = "http://goat.ws/board/images/avatars/114693804644304f35a8399.jpg";
$Url1 = "http://www.goat.ws";

$Img2 = "http://goat.ws/board/images/smiles/gamesc.gif";
$Url2 = "http://www.identity.st";

$Img3 = "http://goat.ws/board/images/avatars/11415438874159139eaacbe.gif";
$Url3 = "http://php.about.com";

//Leave the first number as 1, and set the second to how many banners you have
$num = rand (1,3);

//This creates the variables
$Image = ${'Img'.$num};
$URL = ${'Url'.$num};

//This actully outputs the banner
Print "<a href=".$URL."><img src=".$Image." border=0></a>";
</txp:php>

<small>(Edited for proper display of code. -Els)</small>

Last edited by els (2006-08-01 16:33:22)


Josie

Offline

#4 2006-08-01 16:34:12

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: HTML does not work withing PHP

I edited your post a little ;) How do I post tags and code on the forum?

Offline

Board footer

Powered by FluxBB