Jump to content

My own PHP?


Recommended Posts

Where do I add my own PHP?

Having the entire layout in index.tpl has thrown a monkey wrench into my plan as I NEED the headers (everything before body) to be included from the main site!

It'd be ok if I can do a php include from index.tpl - but, guess what! It actually shows:

<?php include('/includes/nav.php'); ?>

instead of the expected content! ARGH!!!

Help! :D

Link to comment
Share on other sites

I am not sure why you would want to do what you are trying to do, but the .tpl file is a template file.

The template files are like a container which something else goes inside of. - In this case your .php.

I should also point out that template files are used in the .css that CubeCart uses.

- Study the layout of CubeCart, + look for the areas where the .tpl files are referenced + you should see what I mean :D.

Link to comment
Share on other sites

Guest sheriff_bob

No the way its set up now is through using an include file and than using I guess what you would call a module within the .tpl files.

Theres two things to look at here. One is the global template files which contain the header and the footer. Those would include Global > Index.tpl and Globa > Cart.tpl

Also if you want to add your own php as I said before go to

Includes > Content

Then what you can do is create an assigned tag

For example I need my table to create a new row so that I could have 8 products layed out on one page stacked 4 x 2

So in the ViewCat.inc.php I created this









$view_cat->assign("(name of function)","(function value)");

So then when I placed {start} inside my viewcat.tpl it did this function. Which was to allow the new columns up until the point that t reached 6 and then it would create a new row. I'm not the best coder ever and this is probably the weak way to do it. But it works for me.

Hope I answered your question

Link to comment
Share on other sites


I am not sure about this.

I would normally do this kind of thing using HTML 4.0. - It's straightforward, simple, + very versatile. - I find that using PHP usually involves making several hundred lines of code, where 10 in HTML would do the job nicely, but if you prefer working with PHP I am not sure what to advise at the moment.

Anyway, when I have a moment I will have a closer look at this + will post a solution just as soon as I have one to post :unsure:.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...