Jump to content

Creating New pages .tpl


Guest drlarry

Recommended Posts

Guest drlarry

Hi. I had browsed the forums in the past and found out how to actually add new .tpl pages without them showing up in the site docs so I could create extra pages on the website. After upgrading 3.0.16 --> 3.0.17 to fix the UPS bug my site pages I had created will no longer work. Everything I try to access say index.php?act=products it just takes me to the main index page and doesnt load the products page I have made. My code looks like this:

index.php

----------------

case "products":

include("includes/content/products.inc.php");

$body->assign("PAGE_CONTENT",$page_content);

break;

----------------

products.inc.php

----------------------

if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || eregi(".inc.php",$_SERVER['PHP_SELF'])) {

echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";

exit;

}

// send email if form is submit

$products = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/content/products.tpl");

$products->assign("TITLE", "Preferences");

$products->assign("IMPORT", "Import");

$products->parse("send.session_true");

$products->parse("products");

$page_content = $products->text("products");

----------------------

products.tpl

----------------------

<!-- BEGIN: products -->

code here

<!-- END: Products -->

-----------------------

I have several pages I have created that used to work before my upgrade and now no longer work. Any help would be greatly appreciated I been stumped over this for days.

Link to comment
Share on other sites

First of all, HOW did you upgrade? Did you upload files or did you follow the changelog and edit them?

If you uploaded files, then the changes you made previous to that are lost, unless you kept a backup of your work.

Also, the code you posted - is that before or after the upgrade?

What I'm getting at here is that the code has to support whatever templates you want to use. If you customized your store to use different templates, then those customizations need to be maintained during each upgrade.

I'm also pointing out that in order for anyone to help you, we need FULL information.

Link to comment
Share on other sites

Guest drlarry

First of all, HOW did you upgrade? Did you upload files or did you follow the changelog and edit them?

If you uploaded files, then the changes you made previous to that are lost, unless you kept a backup of your work.

Also, the code you posted - is that before or after the upgrade?

What I'm getting at here is that the code has to support whatever templates you want to use. If you customized your store to use different templates, then those customizations need to be maintained during each upgrade.

I'm also pointing out that in order for anyone to help you, we need FULL information.

I did create my own custom template (folder) seperate from the other 3 template folders so nothing was changed to the custom folder in the process. The files all worked before the upgrade. I upgraded by following the instructions in the upgrade folder (3.0.x to 3.0.17.txt).

"a. Take a FULL backup of the database and site files.

b. Upload every file from the uploads folder over your existing files

with exception to the ones listed below:

includes/global.inc.php

install/

language/*/home.inc.php

c. You then need to run the upgrade.php scripts (if there are any). To

do this you need to know which version you were running previously.

Have a look in the /upgrade/scripts/ folder to see if there are any

relevant ones. If so start with the oldest one and copy it to the root

folder of your store. Run this file in your browser and follow the

on screen instructions. Repeat this process overwriting each upgrade.php

script at a time until there are no more.

e.g. http://www.example.com/store/upgrade.php

d. Your store should have been upgraded.

e. You may need to reapply any modifications you have made."

I went back and checked all the files that I had edited and were working before the upgrade with the code I initially posted and all seemed the same unless I am missing something which I probably am. :)

If you need any further information to assist me I will be glad to help as much as I can.

Thank you.

Link to comment
Share on other sites

Guest drlarry

wow I feel like an idiot. Using dreamweaver I must of been viewing the file on my computer and not on the server showing the:

case "products":

include("includes/content/products.inc.php");

$body->assign("PAGE_CONTENT",$page_content);

break;

because after manipulating the index.php file and re-saving it (auto upload) everything is working fine again. I feel like a real idiot :)

Thank you for the help anyways.

Link to comment
Share on other sites

  • 4 weeks later...
Guest aliceaod

THANK YOU

for posting your code, it helped me tremendously. I had been searching for days looking how to add pages outside the ACP and this worked. I found a thread on it but they didn't give details like you did.

Here's how I added a video tutorial page to my site with this method (I call it "viewvid", but anyone could call it whatever is best suited to their purpose):

First, I opened index.php and inserted this where the rest of the "case" statements are:

//add viewvidpage

case "viewvid":

include("includes/content/viewvid.inc.php");

$body->assign("PAGE_CONTENT",$page_content);

break;

//end add viewvidpage




Then I opened /skins/TemplateName/skinTemplates/content/viewprod.tpl  and SAVED IT AS viewvid.tpl



I erased everything in the newly saved viewvid.tpl and put this in:




<!-- BEGIN: index -->

<div class="boxContent">

<span class="txtContentTitle">View Video Tutorial</span>

<br />

<div align="center">***INSERT YOUR HTML VIDEO CODE HERE USUALLY AN OBJECT***</div>

</div>



<!-- END: index -->




Then I opened /includes/content/index.inc.php and SAVED IT AS viewvid.inc.php



Where it says 




$index=new XTemplate ("skins/".$config['skinDir']."/styleTemplates/content/index.tpl");




I changed it to 




$index=new XTemplate ("skins/".$config['skinDir']."/styleTemplates/content/viewvid.tpl");




Then in /skins/TemplateName/skinTemplates/global/index.tpl  I added a link to the new page in my side box where I have "Links and Resources" which looks like this:




<a href="index.php?act=viewvid">

I think that's everything.

Link to comment
Share on other sites

  • 10 months later...

Join the conversation

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

Guest
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...