• Register
Plug-in Tutorial Build an EC-CUBE plug-in

Top Commentators

114

1

EC Mike

SHOGUNSHOGUN

32

2

hrbabu

SAMURAISAMURAI

29

3

Sumant Jha

SAMURAISAMURAI

29

4

justcubed

SAMURAISAMURAI

21

5

Ashok Kafle

SAMURAISAMURAI

21

6

shahith

SAMURAISAMURAI

14

7

Jeemusu

KABUKIKABUKI

14

8

Yangsin

KABUKIKABUKI

9

9

Zaw Hlaing Bwar

GEISYAGEISYA

8

10

Fei Liu

GEISYAGEISYA

Ranking Key

  • FUJISANFUJISAN1,000+ posts
  • SAKURASAKURA500+ posts
  • SHOGUNSHOGUN100+ posts
  • NINJYANINJYA50+ posts
  • SAMURAISAMURAI20+ posts
  • KABUKIKABUKI10+ posts
  • GEISYAGEISYALess than 10 posts

How to create a new page which behave like list.php?

+1 vote
Hi~ I could like to know how to create a new page which behave like list.php as default page?

As i tried to create a new page and paste all code in list.php into it, but it didnt work. Anything I missing?
asked 2013-09-17 by seven_grass (130 points) GEISYAGEISYA

1 Answer

0 votes
Well, if youi're planning on changing the functionality and design of your new list page (I'm assuming you are), the cleanest way to accomplish this is to actually create four new files:

data/Smarty/products/newlist.tpl

data/class/products/pages/products/LC_Page_Products_Newlist.php

data/class_extends/products/pages/products/LC_Page_Products_Newlist_Ex.php

public_html/products/newlist.php

(of course, you can change "newlist" to whatever name you want)

The tpl file contains the layout and HTML for your page, the LC_Page file contains the actual functionality and logic behind the page in PHP and the newlist.php file is what essentially calls all of the others.

Now, each of those files should contain the code of their "list page" counter parts. So, for example, LC_Page_Products_Newlist.php should contain the contents of LC_Page_Products_List.php and newlist.tpl should contain the contents of list.tpl, etc.

You'll also want to call your .tpl file from the LC file. So, in the action function you can add $this->tpl_mainpage = "products/newlist.tpl"

I hope that helps. This is how I usually do it, but maybe there's an easier way. EC Cube staff might have a better solution. Good luck!
answered 2013-09-17 by justcubed (1,120 points) SAMURAISAMURAI
edited 2013-09-18 by justcubed
Very good! Thanks !
In my case, I make new page with some step in Admin Page:

1 - Click Edit design > PC > Page detail setting
2 - input your new page name and URL of your new Page
3 - You can check "use a common header" and "Use a common footer"
4 - The text area is important area to type the template content, you can code all the content of template file for this page here.
5 - click Register and done
6 - in browser, your can type the URL as step 2 for checking.

+ the PHP code of this page was created and saved in "/html/user_data/"
+ The template file was created and saved in "\data\Smarty\templates\default_en-US\user_data" and we can edit it in Admin page
+ To make page similar list.php we just copy Content from  " LC_Page_Products_Lis.php"  to your_page.php as you was created in step 2

I'm just new members, please give me some comment if you have.
---------------------------------------------------------------------------------------------------
One question here:

When I add new attribute in the new_page class (it was defined in new_page.php file as above step) : such as:  $this->mystring = "This is new title";

how to assign it to smarty object ....?? before the template file is called.

thanks you!
...