Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

There must be an easier way to incorporate static HTML pages

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-25-2003, 08:10 PM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default There must be an easier way to incorporate static HTML pages

The site I am developing has about 20 or more static HTML pages that are maintained by other people. The way I figured to create links to these pages and have those pages also include all of the X-Cart menus and functions and navigation is the following laborious process:
  • - Create a unique PHP file for each static page which passes a unique value for the $main variable
    - Modify the home_main.tpl to include {if} statements for those unique variables and {include file=static_html_page} so it shows up in the main content area
    - Set the links to these static pages to point to the specific PHP file

This is a real pain. Is there an easier way? Would it be possible to create a frames page with left, right and top frames that the content would force itself into? Or is that asking for even more trouble?

Any ideas?
Reply With Quote
  #2  
Old 04-25-2003, 11:54 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Yeah there is an easier way

create one PHP file that assigns a value to $main such as "htmlcontent"

Then in home_main.tpl create a new if statement for
{elseif $main eq "htmlcontent"}

have that include one index file similar to the help index file that just calls each file if another variable is set.

If you copy help.php as a base and call it something else then copy the help directory in skin1 this will act as your framework. It will then be really easy to add a new page - just put the includes in the index file and create a new template shell for the new html page, add in a couple of language settings, and add a link to the page.

hth
__________________
ex x-cart guru
Reply With Quote
  #3  
Old 04-27-2003, 11:19 AM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default

Thanks funkydunk - I think I followed what you are saying. I created this file:
customer/content.php which just has these lines in it:
Code:
require "../smarty.php"; require "../config.php"; @include "./https.php"; require "./auth.php"; require "../include/categories.php"; require "../include/help.php"; $smarty->assign("main","content"); $smarty->assign("location",$location); $smarty->assign("section",$section); $smarty->display("customer/home.tpl");
I am sure I left some unnecessary includes in there

Then my links to the static content look like this example:
Code:
content.php?section=aboutus
...and in the home_main.tpl file, I added this:
Code:
{elseif $main eq "content"} {include file="content/index.tpl"}
...and the index.tpl file, which I copied from the help folder as you suggested, I have this:
Code:
{if $section eq "aboutus"} {include file="content/customerinfo/aboutus.html"}
...and the aboutus.html file has been stripped of the HEAD and BODY tags and just includes the content (can I still use {$ImagesDir} in this file?)

I tested it and it was working fine, then suddenly after I made a simple change to the aboutus.html file, I now get this error:
Quote:
Warning: Smarty error: unable to read template resource: "content/customerinfo/aboutus.html" in /home/hemisync/public_html/shop/Smarty-2.3.0/Smarty.class.php on line 589

I double-checked permissions and when I try to edit the file online from the debug console link, the aboutus.html page shows up blank in the editing field. I re-uploaded it from my local copy - still no go.

...AND this still seems like a convoluted way of doing this and I am not seeing how then creating a "section" variable for each static page is any less tedious than just using home.php and then setting the $main variable to specify an individual static page in the home_main.tpl - Did I miss something? Or is this just a cleaner way of doing the same thing without cluttering up the home_main.tpl with an endless string of elsif $main
strings?

Keep in mind, I am a neophyte with PHP and X-Cart, but am fairly good at hacking my way through things and understanding how it works, but the X-Cart app is so split up into so many pieces, it is extremely difficult to keep the big picture in my head I was hoping it would get easier as I work through these issues, but not much. Now my hope is that once I get this site setup, I won't have to mess with it again!

If it wasn't for this forum and your input specifically, I woulda given up on this product long ago!
Reply With Quote
  #4  
Old 04-27-2003, 10:49 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Can you do it with the languages holding the html for display then call that into a tpl file using {$lng.txt_my_content}?
__________________
ex x-cart guru
Reply With Quote
  #5  
Old 04-28-2003, 03:37 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

When the new version (v3.4.0) comes out it has a feature that makes adding your own pages much easier but youll have to wait a while for that one.
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #6  
Old 04-28-2003, 07:53 AM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default

Quote:
Originally Posted by funkydunk
Can you do it with the languages holding the html for display then call that into a tpl file using {$lng.txt_my_content}?

Hmmm - you lost me on that one. Your original suggestion seemed fine if I could get it to work again, but I still get the smarty error and am at a loss as to why.

A key thing here is that my client who has been doing edits on these static pages cannot be encumbered by any of these technical issues, so I want to make it as seamless as possible for them.
Reply With Quote
  #7  
Old 04-28-2003, 10:27 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

might be some javascript that is causing it in the included page
__________________
ex x-cart guru
Reply With Quote
  #8  
Old 04-28-2003, 01:05 PM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default

Turns out it was a permissions issue. The folder permissions for the content had to be set to 777 for some reason.

I finally got a handle on this now. Thanks for your help, fd.
Reply With Quote
  #9  
Old 05-05-2003, 08:37 AM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default

Ok - I've got this thing working fine now - content.php that pulls up an index.tpl file where I have to put variables for each static page and then pass content.php?section=whatever from the links to that content. The issue I have now is that some links need to jump to an anchor link on those content pages. Putting this in the index.tpl didn't work (for reasons obvious even to me when I look at it, but I was desparate.
Code:
{elseif $section eq "anchoronpage"} {include file="content/customerinfo/FAQ.html#specificanchor"}
If I can't have a link pull up a page and jump to an anchor, I have to split the content up into several pages - which kinda sucks. Is there a smarty-er way of doing this?
Reply With Quote
  #10  
Old 06-11-2003, 06:50 PM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default

Quote:
Originally Posted by shan
When the new version (v3.4.0) comes out it has a feature that makes adding your own pages much easier but youll have to wait a while for that one.
Hey Shan - What / Where is this improvement in v3.4?
__________________
-Ken
X-Cart User / Developer Since April 2003
(Varying versions, multiple client sites, 3.x through 4.4.x)
www.pointbweb.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:13 AM.

   

 
X-Cart forums © 2001-2020