Jump to content

php pages


Recommended Posts

this will be different in 1.3x and 1.4x because of the architecture is different.
what PS version are you using?

You can take a existing page as example.

for 1.3x, you will need include header.php and footer.php in your PHP file.
but before that there are a few files need to be included too, like config.inc.php and init.php

include(dirname(__FILE__).'/config/config.inc.php');
include_once(dirname(__FILE__).'/init.php');
.......

include(dirname(__FILE__).'/footer.php');





for 1.4x, you will have to create your own pare controller to inherits FrontController class, and put it in /comntorllers folder.
then in your PHP page, just call the your controller

require(dirname(__FILE__).'/config/config.inc.php');
ControllerFactory::getController('YourPageController')->run();

Link to comment
Share on other sites

it depends on how many page you are going to integrated into.

You can find detailed instructions for 1.3x with samle here

for example(1.4x), if you created a new page name mynewpage.php page.
1. You will need to create a page controller file with name
MyNewPageController.php, place this file in YourSiteRoot/controller/ folder
you MyNewPageController.php must be class the inherits from FrontController class
and also implement/override some of the methods.

2. you will need to create theme file mynewpage.tpl, you must put it under the theme folder
/YourSiteRoot/themes/YourSiteTheme

3. Create mynewpage.php file under your site root.

require(dirname(__FILE__).'/config/config.inc.php');
ControllerFactory::getController('MyNewPage')->run(); 




Hope you can got some idea of it.

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 months later...

Hi there, i also try to create a custom page in 1.4.5.1

 

i created shop/hdmblog.php

 

<?php


/*
* DISCLAIMER
*/

require(dirname(__FILE__).'/config/config.inc.php');
ControllerFactory::getController('hdmblogController')->run();

 

in shop/controllers/hdmblogController.php

 

<?php
/*
* DISCLAIMER
*/



 public function displayContent()
{
	parent::displayContent();
	self::$smarty->display(_PS_THEME_DIR_.'hdmblog.tpl');
}


 

and in shop/themes/mytheme/hdmblog.tpl

 

<p>testtext</P>

 

 

i get a white page.

 

Could somebody throw me a bone here, please?

 

best regards

 

H.

 

Edit: as a final result later on i´m trying to get a page with a custom body but keeping "header" and "top of pages".

Link to comment
Share on other sites

×
×
  • Create New...