Jump to content

PHP & HTML Custom Pages


TomTucka18

Recommended Posts

I'm building out a community that needs some custom pages - the pages will be accessing the DB but also have custom designs. What is the best way to do this? I cannot get it to work using the following methods:

  • Custom Page Only - This accepts all HTML and JS code but any PHP added just gets ignored/ not displayed. 
  • Custom Page with Blocks - blocks accept PHP but don't allow any HTML at all. Workable but would need a custom block for each new bit of php. 

Ideally someone will be able to point out how simple it is to allow PHP on custom pages and how stupid I am for missing it. Thanks in advance. 

Link to comment
Share on other sites

Thanks but I'm not sure that is what I'm looking for. I have tried to create a new "template" and assign when creating a page that uses that template but the template is not visible in the drop down. Is there no way to just create a "page" that allows be to write php/html/js directly?

Link to comment
Share on other sites

Don’t get confused by the word template. Just create a new page in the mode “manual HTML”. There you can add your custom HTML and your custom PHP. But the PHP needs to be in {{// this mode;}}, not <?php this one ;>

CSS and JS are created in the template section and then you can include any CSS or JS file for each custom page you have created. 

Link to comment
Share on other sites

And one last tip - you can create blocks that support raw PHP as you noted, but contrary to what you said you can use HTML there too. You would simply echo/print it.

// Imagine some complex PHP code here.

print <<<EOF
            <strong>and here's the HTML finally...</strong>
EOF;

// I could do more with PHP if I needed to

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...