Redirect Page to Existing PHP Page
  • This may be a fairly basic question but is it possible to have a page display an existing PHP file? So rather than displaying a basic page containing HTML is it possible to include exiting PHP code into that page or possible have the page display an existing.php file? In the past I've used the Jumi extension available with Joomla to integrate my custom PHP page but I'd really like to get over this last hurdle within Tango.

    Thx in advance
  • If you go to Settings -> Editor (or Editing, I forget) then you can enable PHP within the editor. However note that you wont be able to use the WYSIWYG editor and enter in PHP. There are 2 things you can do:

    1) Set the default editor type to verbatim; or
    2) Keep the default as WYSIWYG, but when you start editing make sure the very first line is "#!verbatim", this lets you change the editor type per-page. Save this page, then re-edit and the WYSIWYG editor should no longer be present.

    Hope that makes sense.
  • Well that was pretty basic - Thanks!
  • Although the previous mentioned steps allow me to run basic PHP code just fine I'm still hitting one major snag.

    I'm using the PHP include() statement to call upon some additional PHP code from within my Tango Pages. This works great until the backend code contains a PHP object operator “->”. [example operator structure: $foo->bar();]

    The PHP code executes fine on its own but falls apart in Tango when it hits one of these object operators.

    Any ideas? Thanks again!
  • How do you mean it fails? TangoCMS doesn't do anything to your code, it simply runs what ever you put into the editor.
  • I guess I don't have a great explanation - I'm not all that great with PHP. I've tried to include() many more independently working PHP files into a Tango Page, and each time it fails upon the first encounter of an object operator.

    For example the first operator being used in my PHP file looks something like this:

    echo $devices->TableCaption()

    Then my Apache error always looks something like this:

    PHP Fatal error: Call to a member function TableCaption() on a non-object in MyFile.php on line #, referer: http://localhost/index.php

    I understand this is all still pretty vague - if you think my issue is outside the scope of Tango feel free to ask me to take a hike (-;

    Best Regards!
  • Ok, well yeah that's nothing to do with TangoCMS. You're trying to call the "TableCaption" method on the $devices variable, however the $devices variable you have is not an object. So the problem is within your code.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Tagged