Find out more about the “Show Off Your Avatar Campaign
RocketTheme  |  General  |  General Discussion  |  Topic: Using PHP Tags in news items (SOLVED) « previous next »
Pages: [1] Go Down Print
Author Topic: Using PHP Tags in news items (SOLVED)  (Read 2962 times)
Eduardo Farias
Newbie
*
Offline Offline

Posts: 8

Using PHP Tags in news items (SOLVED)
« on: July 06, 2006, 10:40:28 AM »

I'm trying to make some database calls within news and faq items.  I tried using the edit HTML source for a FAQ item, but it seems like it just comments out all the php code.

I have a feeling I'm missing something simple to get this to work right.

Any help is appreciated, thanks.

I tried searching the forums, but I'm not sure I wording it correctly to find an answer.

Ed
« Last Edit: July 07, 2006, 02:46:45 AM by Yves Gabioud » Logged
Thomas
Professional
Hero Rocketteer
*
Offline Offline

Posts: 988


Homage Photo Booth

WWW
Re: Using PHP Tags in news items
« Reply #1 on: July 06, 2006, 11:31:23 AM »

In your admin area go to global settings and turn of the "WYSIWYG" editor, then when you make the custom stuff you can paste it without the editor just kills it.

When you have saved your work you can turn the editor back on.

Just remember to turn it off if you want ot modify the code, because if the WYSIWYG editor is on when entering the custom stuff you made it will all be gone again..
Logged

MintCreation - Affordable and creative Joomla Sites
http://www.mintcreation.com

Joomla! - tips, tricks and tutorials - (new site coming soon)
http://www.beta-code.com
Eduardo Farias
Newbie
*
Offline Offline

Posts: 8

Re: Using PHP Tags in news items
« Reply #2 on: July 06, 2006, 11:37:13 AM »

Awesome, thanks Thomas.
Logged
Eduardo Farias
Newbie
*
Offline Offline

Posts: 8

Re: Using PHP Tags in news items
« Reply #3 on: July 06, 2006, 11:57:55 AM »

Can you think of any reason it wouldn't work?

I took the same code and created a PHP file and copied to my server and it works fine.

With the WYSIWYG off, I pasted the same code in a News item, but it does not show the results.

Is there something else I need to do?

Here is the code.  I starred the username and password for this post.  Like I said above, this same code works fine when put into a seperate .php file and copied to the server.  See here (www.aiabgames.com/temp/test.php)

Code:
<?
$username="******";
$password="******";
$database="aiabgame_joomla";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query="SELECT * FROM jos_games WHERE Type='Joystick'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
<html>
<head><center>
<?
$i=0;
while ($i < $num) {

$Title=mysql_result($result,$i,"Title");
Echo $Title;
Echo "<BR>";
$i++;
}
?>

</center>
</body>
</html>

Thanks
« Last Edit: July 06, 2006, 12:11:13 PM by Eduardo Farias » Logged
Andy Miller
RocketTheme
Hero Rocketteer
*
Online Online

Posts: 6034


RTTC Kahuna

Re: Using PHP Tags in news items
« Reply #4 on: July 06, 2006, 03:09:00 PM »

Joomla strips out php tags in content for security reasons.  There is a plugin available on extensions.joomla.org though that alllows you do put in php code though, I forget the name.
Logged
Eduardo Farias
Newbie
*
Offline Offline

Posts: 8

Re: Using PHP Tags in news items [Resolved]
« Reply #5 on: July 06, 2006, 07:49:31 PM »

Yup, I found it.

It's called kl_php, and it works like a champ.

Thanks for the help all.
Logged
Pages: [1] Go Up Print 
RocketTheme  |  General  |  General Discussion  |  Topic: Using PHP Tags in news items (SOLVED) « previous next »
Jump to: