include files -- how to edit

Questions and answers about ShopSite Custom Templates

include files -- how to edit

Postby truesdell » Thu Jan 10, 2013 1:17 am

I am new to ShopSite. Using ver 11.

I have the following line in a template:

Code: Select all
[-- include my-footer.html process --]

the path for the file 'my-footer.html' is '/ss-data/templates/includes/my-footer.html'

When I edit that file, the changes do not show up on the site.
I have flushed the cache, used different computers, etc. The change doesn't "take." The file modification date is correct on the server and if I look at the contents of that file ( less /ss-data/templates/includes/my-footer.html ) it shows my changes.

Question 1: how does the [-- include --] directive know to look in /ss-data/templates/includes/ ? Or does it? Is it looking somewhere else? Where would I change that?
Question 2: why isn't this change being read in?
Question 3: am I going against the "ShopSite Way" to edit this include file directly? If so, what's the proper procedure?
truesdell
 
Posts: 18
Joined: Thu Jan 10, 2013 12:33 am

Re: include files -- how to edit

Postby Jim » Thu Jan 10, 2013 7:15 am

Question 1: how does the [-- include --] directive know to look in /ss-data/templates/includes/ ? Or does it? Is it looking somewhere else? Where would I change that?
Answer 1: The template code first checks in the data/templates/ directories for any file that is referenced. If the file is not found in that location then it looks in the sc/templates/ directories. If the file isn't found an error will either be displayed on the publish screen or a comment will be inserted in the generated html.
Question 2: why isn't this change being read in?
Answer 2:How do you know that the code is not being read in? Perhaps the include statement is in an [-- IF ... --] block that prevents it from being included, because the conditions of the IF is not met? Or if it is a product template maybe your template is not being called at all because the page template is overriding the template used for products.
Question 3: am I going against the "ShopSite Way" to edit this include file directly? If so, what's the proper procedure?
Answer 3: If you you are editing the include file (or any template file) out side of the ShopSite interface you must make sure that it has the proper permissions and ownership of the publish code won't be able to access the file. But it is perfectly acceptable to edit the file however you want and then ftp the file to the appropriate location on the server. You should not, however, edit any html file that ShopSite generates when the store is published because it will be overwritten the next time you publish the store.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: include files -- how to edit

Postby truesdell » Fri Jan 11, 2013 12:50 am

Thanks for your insight.

I inherited a site which looks like it was implemented with a pretty heavy hand, more likely several heavy hands.

Question 1.1 Can I get deeper info on how the [-- include --] path might be other than those 2 you mentioned?
Is there a config setting somewhere?
The server is live and functioning and a file is getting included; I just don't know which file, specifically, is the one getting included. Somewhere there must be a config file telling the ShopSite engine where to look for include files. It can't be hard-coded because those two paths you mentioned are not on our server.
truesdell
 
Posts: 18
Joined: Thu Jan 10, 2013 12:33 am

Re: include files -- how to edit

Postby Jim » Fri Jan 11, 2013 8:23 am

Those two places are the only locations where the template files are located, one is in the store's data directory and the other is in the shopping cart cgi directory. The names of those directories can be change when the store is install. The shopping cgi directory is generally call sc or bo the store's data directory is generally called data or ss-data etc. If you go to Preferences > Hosting services the paths to the directories are listed at the bottom of the screen.
The template files themselves will all be in a /templates/ subdirectory under the data or shopping cart cgi directory. There will then be subdirectories in the templates directory called sc, gc, pages, products, includes, publish, etc each of those directories corresponds to the sections where you can edit templates under Merchandising > Custom Templates , Pages, Product, Includes, Publish, Search, Gift Certificate, Shopping cart etc.

Another possible place where html code could be placed so it will display on all published store pages is Preferences > Layout settings in the Header and Footer sections But the template tags that have the format [-- include ....--] can not be used in that location or any other text field for pages, product, etc.

Note that it is possible for any of the template files to use the [-- include ... --] statement, so you can have an include file that also uses the statement. I believe that it can go up to 32 levels deep so you might have to look through a bunch of files to find what your are looking for.

There is a section on the Utilities > Publish screen where you can enable the printing of the template name as comment in the html that is output. So you can enable that then go to the page with the problem, view the source of the page and find the comment with the template name, just above the area where the problem occurs. That may help in getting closer to finding what file is actually being called.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: include files -- how to edit

Postby truesdell » Fri Jan 11, 2013 4:18 pm

Super! You have given me a LOT of very useful info.

OK... into the fray!
truesdell
 
Posts: 18
Joined: Thu Jan 10, 2013 12:33 am

Re: include files -- how to edit

Postby truesdell » Fri Jan 11, 2013 5:26 pm

I looked at Utilities > Publish with an eye to enabling comments as that's how I would trace this stuff if I was hand-coding.

At the bottom of that screen I found the [Regenerate] button. I clicked.

Now the include file in question shows up with my edits in place.
That is a problem (and, actually, an entire family of problems) solved.

Onward!

Thank you for your help!

--scott
truesdell
 
Posts: 18
Joined: Thu Jan 10, 2013 12:33 am

Re: include files -- how to edit

Postby Jim » Fri Jan 11, 2013 9:44 pm

Yes, if you make a change to a template and you want the change to take affect then you need to publish the site. Since a merchant may not want template changes to go into effect immediately the Publish tab does not popup when you change a template. If you had changed a page or product that used that template then the Publish tab would have displayed and clicking the tab would have published just those pages affected. To force a publish of the entire store you use the Regenerate button as you discovered. Sorry I should have mentioned that earlier, I to it for granted that you were publishing.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: include files -- how to edit

Postby truesdell » Sat Jan 12, 2013 1:45 pm

Like I say, I'm new to ShopSite. I'm just now coming to grips with the hybrid static/dynamic way ShopSite works.

I'm rather peeved that the people who initially designed my site used Apache Server-Side Includes instead of PHP. :x I haven't used SSI since last millennium!

This whole exercise was to change the copyright date from static to (c) 2000 - [$current_year]
But the stuff I learned tracking this down helps immensely with future projects on the site.

Besides putting out fires, my long-term project is to transition to sane page templates. You would not believe the weird hacks which are in place now. Again: :x The file system is a train-wreck with files scattered willy-nilly all over the place including a hugely bloated root directory with hundreds of img files just sitting there. Don't even talk to me about filenames! Most look like they still have the names assigned by the camera. :roll: Product names are equally random with no scheme or convention. Listen to me whine like a little bitch! :lol:
truesdell
 
Posts: 18
Joined: Thu Jan 10, 2013 12:33 am


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 10 guests

cron