basics

Locked

Views: 6,182

Results 1 to 20 of 49
This thread is locked. New replies are disabled.
17 Feb 2007, 9:41 AM
#1
jagguy avatar

jagguy

New Zenner

Join Date:
Feb 2007
Posts:
64
Plugin Contributions:
0

basics

q1)What is the difference betweena module and template. I see a sidebox has both.
If I want to add to the sidebox eg extra html then which do i use a template or module?

q2) How can I change the CSS for a specific sidebox ? Can I use a custom overrides or can't you do this to specific parts?

17 Feb 2007, 10:00 AM
#2
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: basics

For the second, see this recent post - http://www.zen-cart.com/forum/showthread.php?t=50926

In terms of sideboxes and pages, the template is the layout (governed by the css in the stylesheet) and the module is the content of the template...

Not to be confused with the template which governs the overall look of your site and the add-on modules found in the downloads section! :D

Check out the tutorials/FAQ - I'm fairly sure there are instructions on creating extra sideboxes soemwhere in there.

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

17 Feb 2007, 10:47 AM
#3
jagguy avatar

jagguy

New Zenner

Join Date:
Feb 2007
Posts:
64
Plugin Contributions:
0

Re: basics

ok so if I am going to add html/css/javascript then add it to the template , and if I am going to add content from a DB eh php/mysql then change the module.

17 Feb 2007, 11:56 AM
#4
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: basics

That's about it... examine (as an example)

includes/templates/template_default/sideboxes/tpl_information.php

and includes/modules/sideboxes/information.php

And don't forget to save changed files to your overrides directory.

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

17 Feb 2007, 11:42 PM
#5
jagguy avatar

jagguy

New Zenner

Join Date:
Feb 2007
Posts:
64
Plugin Contributions:
0

Re: basics

Hi,

What is confusing me is the interaction between modules and templates with php code.
In zencart modules I see php/mysql code but no echo statements. So if I am to do a new box or modify and existing box, do i need to have a deep understanding of the zencart php code to do it the same way?

How does zencart output php/mysql data?

I normally have php and html/css in seperate sections or files. If I need to use php with html code eg a table full of mysql data I just use echo staements with table elements.This makes things simple.

18 Feb 2007, 1:06 AM
#6
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Re: basics

each of the sideboxes will have there own IDs, so you can address style changes in the stylesheet directly for each sidebox....

example for categories sidebox:```
#categoriesContent.sideBoxContent


example for bestsellers sidebox:```
#bestsellersContent.sideBoxContent

Not all selectors are in the stylesheet so you'll have to add them.

The modules do the work of preparing the info for display and the template files handle the actual display. In general the info doesn't change but how you want to present it does, so that would be the reason for separating them.

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

18 Feb 2007, 1:58 AM
#7
jagguy avatar

jagguy

New Zenner

Join Date:
Feb 2007
Posts:
64
Plugin Contributions:
0

Re: basics

What i wanted to know is am i suposed to follow the zencart way of
'of preparing the info for display and the template files handle the actual display'.

I have no idea how to do this, and prefer not to do it to be honest.

I would really need to know a lot about the zencart code to get php code to interact with zencart logic.

18 Feb 2007, 2:09 AM
#8
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Re: basics

Can you give me an example of what your asking as I don't get the question your asking. If your looking to change the way something looks then most of the work will bed in the stylesheet and tpl_ files. I have not had reason to mess with the logic in the modules files ......yet.

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

18 Feb 2007, 4:42 AM
#9
jagguy avatar

jagguy

New Zenner

Join Date:
Feb 2007
Posts:
64
Plugin Contributions:
0

Re: basics

I didn't undertand the module files as they weren't standard php code ideas. Usually a fle with php/mysql uses a echo staement to print to the screen with data from mysql and these modules don't. They set variables for further processing to other files. Bascially i didn't want to code that way.

So if i wanted to add a box with html,css,php/mysql then i would use the template file.

18 Feb 2007, 4:53 AM
#10
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Re: basics

yes.........I think....don't know never had to put my own php in a sidebox.....try it let me know how it turns out

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

18 Feb 2007, 5:02 AM
#11
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: basics

What is confusing me is the interaction between modules and templates with php code.
In zencart modules I see php/mysql code but no echo statements.
There are functional files that retreive the data and the template files 'tpl' that describe how this is to be displayed.

You can work around this if you wish but realize that in some cases you will lose the ability to control from the admin and or the dynamic nature of the cart. Or as it can be termed this will end up being hard code.

Zen-Venom Get Bitten

18 Feb 2007, 5:24 AM
#12
jagguy avatar

jagguy

New Zenner

Join Date:
Feb 2007
Posts:
64
Plugin Contributions:
0

Re: basics

well the php code in modules isn't easy to understand and neither is it regarded as 'common php practice'.
To code like that would be near impossible for a newbie to zencart.

18 Feb 2007, 11:00 AM
#13
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: basics

I don't really get what you are trying to do, and my own knowledge of php is very limited, but the structure here seems quite straightforward to me... the module file compiles the content from a variety of sources and the template file displays it.

Perhaps if you could give an example of what you are trying to achieve, we may be able to understand your argument better - but why not just go ahead and try to do it the way you want to?

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

18 Feb 2007, 2:57 PM
#14
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Re: basics

neither is it regarded as 'common php practice'. 

Well, what you don't think is common practice actually is common practice....
What has essentially been done is to separate the logic from the presentation. Being that the code in the template files can be rearranged to your hearts content can you imagine what would happen if the two were mixed together. There isn't enough time in the day to answer all the questions from "noobies" that would break things. So for those that don't need to mess with the logic, it has safely been tucked away where they don't have to see it. I do understand why you would like the logic and presentation together but in this enviroment it would be a nightmare to support.

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

18 Feb 2007, 11:49 PM
#15
jagguy avatar

jagguy

New Zenner

Join Date:
Feb 2007
Posts:
64
Plugin Contributions:
0

Re: basics

It is adding your own pages with content that is confusing me . I am trying to fit into a pre-defined system ( which I need to know how to make mods to ).

Ok maybe I need to explain with an example.

I have a php file that gets say all the category names and i want them displayed in a html table, and maybe some css with it. The coding is simple enough.

It is easier to have the php stuff in 1 file and css/html in another. Now I want this page in the content area, and a link to it in a sidebox.

Do I create an ezpage and add it all in but the thing is in 2 files? So do i just add the whole code in 1 file.

How do i add a content page with php/css/html?

19 Feb 2007, 12:08 AM
#16
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: basics

ezpages and the defines pages can only parse html - php will not parse in these pages

Zen-Venom Get Bitten

19 Feb 2007, 12:09 AM
#17
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Re: basics

not exactly true kobra

maybe reading this thread will help you.....http://www.zen-cart.com/forum/showthread.php?t=37252&highlight=php+ezpages

I wish I understood more what this page is for......as it seems to be familiar....kinda like display categories on main page.....which there is a switch for in the admin someplace......but I don't know what your end result is supposed to be...

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

19 Feb 2007, 12:19 AM
#18
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: basics

Mike,

Looked at that and I am with Ajeh on this(and if Ajeh is finding this problematic...Well!!!:

Ajeh:

I can see it is coded to do this ... but I am having a user moment here ... and not getting it to actually execute the php code ... so what's the trick?
I will have to investigate further but am leery about DrBytes caution also, and if this actually is supported and will validate properly

jagguy,

Can you provide a susinct example of exactly what you are trying to do?? Please not maybe this and maybe that....

Zen-Venom Get Bitten

19 Feb 2007, 12:43 AM
#19
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Re: basics

ok well I didn't read the whole thread on that one but I thought it maybe pointed towards where he was wanting to go........my bad

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

19 Feb 2007, 2:00 AM
#20
jagguy avatar

jagguy

New Zenner

Join Date:
Feb 2007
Posts:
64
Plugin Contributions:
0

Re: basics

What I want to do is add php content and html/css for my own pages. I gave an example but why am I getting people say explain what is it you are trying to do? I am trying to understand what zencart can and can't do.

I have existing websites I want to fit in but if all zencart CAN do is use an existing layout with minor changes only then it is a little limited, and maybe for a person without much IT background.

Ecommerce carts like this are just php/html/css/JS that someone has created.

The 'what is it you are trying to do exactly' replies can be explained . It is simple, I am trying to develop flexible websites that don't all look the same.

q)Can you add your own php content to a new page and display in content area? how?

It is a general question to see if you zencart can ( i gave an example earlier for a php data table ).

q)Can you add a page with php/html/js? How?