You are here:  » How PT comes together?

Support Forum



How PT comes together?

Submitted by daem0n on Thu, 2009-05-07 09:55 in

Hi David,

This may sound like a stupid question but I realize I still don't understand how PT comes together as a script. Is there any way to explain the flow of the script?

Say for instance a user goes to your index page and puts a query in the search form. In what order are the files called and what does each one do?

I'm confused because I don't really understand the difference between products.php and search.php or the other "MAIN" files (as opposed to the HTML files).

I'm sure this would help a lot of people out (or at least someone learning PHP and PT, like me).

Thanks a lot! -Joe

Submitted by support on Thu, 2009-05-07 10:05

Hi Joe,

Essentially there is only one main .php file called for type of page; the primary ones being search.php which does the searching and displaying of results, and from there, each product is linked through to products.php which generates the Price Comparison page. The basic structure of each main script is the same - perform the database access etc. and load global variables of the same names as the html/ files, and then call the necessary html files to generate the output.

The basic flow from each of the starting points is

index.php > search.php?q=keywords > products.php

index.php > merchants.php > search.php?q=merchant:Merchant Name > products.php

index.php > brands.php > search.php?q=brand:Brand Name > products.php

index.php > categories.php > search.php?q=category:Category Name > products.php

Finally, if using search engine friendly URLs ($config_useRewrite = TRUE) then some of the above are actually rewritten as follows:

/merchant/ > merchants.php
/merchant/Merchant-Name/ > search.php?q=merchant:Merchant Name

(and the same for /brand/ and /category/)

Hope this helps!

Cheers,
David.

Submitted by daem0n on Thu, 2009-05-07 23:44

That's exactly what I was wondering. Thanks a lot David, this helps a lot!

-Joe