Jump to content

Help understanding templates, plugins, and themes


Recommended Posts

I am trying to wrap my head around PrestaShop and I am not finding what I am looking for in the documentation.  Maybe I am just really bad at reading the documentation, but I haven't been able to understand very much of the system.  I have a list of questions and if I could get any answers it would be very helpful to my understanding:

1. What is the order of events that the system goes through to generate a page?

2. I see a lot of talk about hooks: what hooks go to what space on the page, but I don't see any examples on HOW TO USE those hooks.  I don't even know if they are used in .tpl files or .php files, or if they are only for modules to use or anything.

3. Is it possible to write a template that says: "Ask this particular module to generate a block here"?

3. a. If not how can I move module blocks around, or are they locked in place by the module's own code?

 

4. Where do I go to enable or disable a left or right column on a page?

 

I am finding PrestaShop very difficult to use because the manual for it is not as detailed as I would like, so a basic explenation of the system would be very helpful.

Link to comment
Share on other sites

1. first script loads index.php file, this file loads configuration file and run Dispatcher. Dispatcher is class that loads your shop. Depending on what page you want to browse it loads controllers (from /classes/controllers and /controllers/ directories).

Then everything depends on controllers (like load tpl files etc.)

 

2. Hooks are a places where the visible parts of modules appear. Hooks are defined in controllers, then contents of these hooks are attached to smarty array as a variables. Then, in tpl files these variables are displayed (with code like {$HOOK_LEFT_COLUMN} - for left column hooks - you can find it in header.tpl file)

 

3. No, it's not possible, whole "theming" in ps is based on hooks.

You can move hooks around with modules > positions tab in back office. you can change positions of modules there.

 

4. in header.tpl and footer.tpl files located in your theme directory

  • Like 1
Link to comment
Share on other sites

Ok great, my understanding is already a lot better.

On the first question, I get how the url directs the system to a particular controller.  I guess what I don't understand is this: do all PrestaShop themes use the same controllers?  Or does the controller change for every theme?  I am also wondering about modules.  How much php are they based on and how much are they based on templates?  If you don't call one module at a time, what exactly happens to modules give their destination on the page?

Edited by 4th_dimention (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...