0
Welcome Guest! Login
0 items Join Now

SOLVED Using PHP Tags in news items

    • Eduardo Farias's Avatar

    SOLVED Using PHP Tags in news items

    Posted 18 years 10 months ago
    • 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: 18 years 10 months ago by .
    • 's Avatar

    Re: SOLVED Using PHP Tags in news items

    Posted 18 years 10 months ago
    • 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..
    • Eduardo Farias's Avatar

    Re: SOLVED Using PHP Tags in news items

    Posted 18 years 10 months ago
    • Awesome, thanks Thomas.
    • Eduardo Farias's Avatar

    Re: SOLVED Using PHP Tags in news items

    Posted 18 years 10 months ago
    • 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 )
      <?
      $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: 18 years 10 months ago by .
    • Andy Miller's Avatar
    • Andy Miller
    • Preeminent Rocketeer
    • Posts: 9919
    • Thanks: 96
    • Web Kahuna

    Re: SOLVED Using PHP Tags in news items

    Posted 18 years 10 months ago
    • 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.
    • Eduardo Farias's Avatar

    Re: SOLVED Using PHP Tags in news items

    Posted 18 years 10 months ago
    • Yup, I found it.

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

      Thanks for the help all.

Time to create page: 0.169 seconds