Jump to content

[F] PHP in pages


roboa

Recommended Posts

  • Administrators

You can create your own php pages and place them in the "Pages" folder and then call them through  <your site>/index.php/Pages/yourpage, or that is what has worked for me. I have not tried the pages module in the admin center although I think that is designed for static pages versus pages that are calling functions and such. It is easy to create your own module as well and create new dynamic pages through that method. The great way Nabeel has designed this app makes it easy to add your own content.

Link to comment
Share on other sites

  • Administrators

If you're gonna use a lot of php, it's better to create a module, and you can call whatever you want in it.

If it's just a few lines, you can add them via the html pages in /core/pages/[yourpage].htm. I am not sure if you can add PHP directly using the source mode of the editor

Link to comment
Share on other sites

  • 3 weeks later...

I've put 2 pages in the pages folder which contain this php:

<?php

echo "Hello, this is a test of the page test.php!!";

?>

One file is test2.php and the other is just test.htm and neither will show. I just get the page missing alert. Am I doing something wrong?

cheers,

roboa

Link to comment
Share on other sites

Ok, so I now have a file called test.htm in the core/pages folder with this content in it:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>test</title>
</head>

<body>
<?php

echo "Hello, this is a test of the page test.php!!";

?>
</body>

</html>

So the address for the page would be http://fcava.co.uk/index.php/pages/test but it displays the no page error. When I try to add the page through the admin panel I get this error:

Warning: fopen(/home/fcava./public_html/core/pages/phptest.htm) [function.fopen]: failed to open stream: Permission denied in /home/fcava./public_html/core/common/SiteData.class.php on line 255

cheers,

roboa

Link to comment
Share on other sites

Cheers Nabeel, got that working all nicely now!

I'm trying to call the routemap to a page now and am using this:

<?php

MainController::Run("RouteMap", "ShowMap");

?>

Now, it sort of works and does bring up a google map but with no information and some joyful errors :D Is there anyway I can modify that to make it work?

Link to comment
Share on other sites

These are the errors I get:

Warning: Missing argument 1 for RouteMap::ShowMap(), called in /home/fcava./public_html/core/classes/MainController.class.php on line 295 and defined in /home/fcava./public_html/core/modules/RouteMap/RouteMap.php on line 39

Warning: Invalid argument supplied for foreach() in /home/fcava./public_html/core/modules/RouteMap/RouteMap.php on line 50

Warning: Division by zero in /home/fcava./public_html/core/modules/RouteMap/RouteMap.php on line 74

Warning: Division by zero in /home/fcava./public_html/core/modules/RouteMap/RouteMap.php on line 75

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...