Jump to content
DiamondSea

[contribution] Simple Template System (sts)

Recommended Posts

I have an error, and this is it, after adding STS to the site.

 

Any ideas?

 

Fatal error: Call to a member function on a non-object in /home/xxxxxxxx/public_html/catalog/includes/header.php on line 28


John Oligario

 

Knowledge Base Contributions

Share this post


Link to post
Share on other sites

Hey, I am totally new to this, but an experience computer user, and mild programmer. I have done everything your text file says from how to install down to how to use. I have just made color changes on the template html and I can't get it to acknowledge the changes on the catalog site. When I go into

 

In the /catalog/includes/application_bottom.php file you can see the

following settings (near the top of the file):

 

$display_template_output = 1;

$display_normal_output = 0;

$display_debugging_output = 0;

 

The closes thing I see to the above is: // Print everything out

require(STS_DISPLAY_OUTPUT);

 

 

Is that what I can. Thanks.

 

Thank you for your contributions.

Share this post


Link to post
Share on other sites

hi, I would like to add something like this "Your shopping card is = " in "sts_template.html"

but dont' know how to do this

Here is the code that does what I want, but dont' know where to add this

 

<td valign="top" width="21"><img src="images/cart.gif" alt="cart" width="21" height="16"></td>
<?php
if ($cart->count_contents() == 0) {
?>
<td valign="top" class="smallText">Your cart is empty.</td>
<?php
} else {
?>
<td valign="top" class="smallText"><?php echo '(' . $cart->count_contents() . ')' .  ($cart->count_contents() == "1" ? " Item" : " Items "); ?>  /  <?php echo $currencies->format($cart->show_total()); ?></td>
<?php
}
?>

Share this post


Link to post
Share on other sites

Fresh install of oscommerce 2.2, did the instructions, cant figure this out. Other people have asked this but noones answered, at least what ive read in the forums.

 

Warning: main(includes/filenames.php): failed to open stream: No such file or directory in /home/directory/public_html/shopping/includes/application_top.php on line 53

 

Fatal error: main(): Failed opening required 'includes/filenames.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/local/') in /home/directory/public_html/shopping/includes/application_top.php on line 53

 

Whats that mean?

I dont have a filenames php or anything laying around... not sure what any of this means. I need help getting my shop up...

Sorry if its a real noob question...


I love you all!

Share this post


Link to post
Share on other sites

Some one please help me...

 

I got everything working except this .

 

again here is the code

 

<td valign="top" width="21"><img src="images/cart.gif" alt="cart" width="21" height="16"></td>
<?php
if ($cart->count_contents() == 0) {
?>
<td valign="top" class="smallText">Your cart is empty.</td>
<?php
} else {
?>
<td valign="top" class="smallText"><?php echo '(' . $cart->count_contents() . ')' .  ($cart->count_contents() == "1" ? " Item" : " Items "); ?>  /  <?php echo $currencies->format($cart->show_total()); ?></td>
<?php
}
?>

 

I want to call this code in my "sts_template.html"

like this "$shortshopping" or something

some one please show me, where to add above script?

Please

Share this post


Link to post
Share on other sites

Hi Brian

 

Your contribution is great. Makes it so easy to layout a different feel to a store.

 

I have one problem. I've searched for a solution within this thread but can't find one.

 

Any images reference from STS_template.html need to be absolute paths because I have a shared SSL server so relative paths won't work. However, having absolute paths causes the browser to register a non-secure item, adn if the user chooses to view it the security icon is turned off.

 

This is not great for instilling trust in my customers. Any idea how this can be solved?

 

My incomplete site is:

http:www.kidzdens.co.uk/catalog

 

Thanks

Tim

Share this post


Link to post
Share on other sites

Hello,

 

I've add STS 1.8 and every thing works smoothly with one exception.

 

Search Engine Friendly URLs.

 

It seems that when I enable this function, my template looses all CSS formatting. Instead of showing the standard default colors on the page (which are set in my stylesheet) I simply get a white page with black text. It all works fine until I click on a product to view the information on it.

 

Look at my shop, and then look at the link below.

http://www.lockedsales.com/shop/

 

Here's the link to a product (you can see what I mean by looking at this after looking at the link above.

http://lockedsales.com/shop/product_info.p...1/products_id/1

 

Any and all help will be appreciated...

 

Trent

:blink:

Share this post


Link to post
Share on other sites

Hi.

 

I am installing the linda's contribution (loginbox), but i still can't see anything, i mean, the contrib doesn't appear on the screen.

 

I started to upload the files [just two files (the first on the boxes directory and the second on the language directory)].

Then i went to columnleft.php (that's were i want the contrib to be) and added the code:

 

require(DIR_WS_BOXES . 'loginbox.php');

 

// STS: ADD

// BOF: WebMakers Added: Login Box My Account

$sts_block_name = 'logbox';

require(STS_RESTART_CAPTURE);

// EOF: WebMakers Added: Login Box My Account

// STS: EOADD

 

Then i went to sts_display_output.php and added the following code:

 

at the

 

/////////////////////////////////////////////

////// Create custom boxes

/////////////////////////////////////////////

 

i added the following:

 

$template['logbox'] = strip_content_tags($sts_block['logbox'], 'logbox');

 

 

 

and at the

 

/////////////////////////////////////////////

////// Display HTML

/////////////////////////////////////////////

 

i added the following:

 

echo $sts_block['logbox'];

 

(at the // print column_left stuff)

 

 

i thought it was just these two files i had to modify, but still, it doesn't seem to..

 

Could please someone help me?

 

The basic question here is: if i want to add another box, what do i have to do?What files do i have to modify?

 

 

Thanks people for all this you have created (not just the contrib, but the support also)

 

 

....and a Happy New Year..

 

 

Bruno Marto @ Portugal

Share this post


Link to post
Share on other sites

Sorry.

 

I just saw my post and i forgot that i also added the $logbox in the sts_template.html.

 

Problem solved.

Share this post


Link to post
Share on other sites

First off I have to say...brilliant contribution, thank you VERY VERY much!

 

Like most people here I know html pretty good, php not so good but I made the site run and made some changes to the look and it functioned just fine. I was still frustrated with trying to get a "look" for my site. Then I added your script and OH MY GOD I am free!! Free to do as I please with my site!!!!!!!!!!!! You are the man!!! I am going to change my kids names to Simple, Template and System in your honor... :) ...lol

 

Anyways I have one small problem with it. I am using multi-templates and it works like it should of course. But I am using a shared ssl so the templates that are used on the secured side dont work. It still use the default template just fine.

 

Any hints on fixing this?

 

I really need to get a certificate of my own I know since the email that goes out to the customer to update them on their order contains my shared ssl url which doesnt really look good. But for now I would like to fix this shared ssl problem.

 

Thanks,

One Happy Camper!


The Wiki Docs: Read them, live them and be thankful for them!

Share this post


Link to post
Share on other sites

I got the multi page shared ssl figured out. I just didn't have all the proper file created in catalog/includes/sts_templates/login.php.html and so on. Works geat now...wow my site is sooooo different looking!!!! I love it!


The Wiki Docs: Read them, live them and be thankful for them!

Share this post


Link to post
Share on other sites

After many people telling me to try out the STS (1.8) I finally have the time to do so. Problem is that I want a page to show a specific category, but it won't do it.

 

In my case the index page will start on a specific category.

 

How would I do this?

 

Thanks for all your great help.

 

Cy

 

PS: Sorry for the cross-post.

Share this post


Link to post
Share on other sites
I just installed osCommerce 2.2 and STS 1.8. Everything seems fine except that after installing STS, every page ends with "</". I don't see these characters in sts_template.html or footer.php files.

 

Can anyone help?

Did anyone ever find out what causes this? Thanks!

 

_brian

Share this post


Link to post
Share on other sites
I just installed osCommerce 2.2 and STS 1.8.  Everything seems fine except that after installing STS, every page ends with "</".  I don't see these characters in sts_template.html or footer.php files. 

 

Can anyone help?

Did anyone ever find out what causes this? Thanks!

 

_brian

If I recall correctly, it was a bug in an older version of PHP itself. If you upgrade to a newer version of PHP, it should go away.

 

- Brian

Edited by DiamondSea

Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://forums.oscommerce.com/index.php?showtopic=58541

Share this post


Link to post
Share on other sites

hi, I would like to add something like this "Your shopping card is = " in "sts_template.html"

but dont' know how to do this

Here is the code that does what I want, but dont' know where to add this

 

 

CODE

 

<td valign="top" width="21"><img src="images/cart.gif" alt="cart" width="21" height="16"></td>

<?php

if ($cart->count_contents() == 0) {

?>

<td valign="top" class="smallText">Your cart is empty.</td>

<?php

} else {

?>

<td valign="top" class="smallText"><?php echo '(' . $cart->count_contents() . ')' . ($cart->count_contents() == "1" ? " Item" : " Items "); ?>  /  <?php echo $currencies->format($cart->show_total()); ?></td>

<?php

}

?>

 


Share this post


Link to post
Share on other sites

Speed,

 

Not real sure what you want. Why dont you just use the $cartbox in the template to display cart contents? Mine I have a link to shopping_cart.php if they need to see the cart contents. Plus the $cartbox starts showing up depending on where the surfer is in my store and his shopping cart status.

 

You could also try the include command to call the shopping_cart.php. The include command is not a php but html. I cant remember how it goes but you could use it inside a cell or table and it will always display that url...maybe. DO a search on google or something for the include format...went something like <include url;www.blah blah


The Wiki Docs: Read them, live them and be thankful for them!

Share this post


Link to post
Share on other sites

My main page looks different than categories, but unfortunately STS1.8 does not (yet?) support template for a category. So I made something myself. I'm not a php guru, so use this at your own risk. This works for me, but it may not work for you...

 

This implementation has that each category has a own template or all categories uses a common template.

 

A) Open sts_display_output.php

 

B) Find a line:

$scriptname = getenv('SCRIPT_NAME');

Add below:

//Category template: Read query
$isacategory = getenv('QUERY_STRING');
//Use common template for a category 1=yes, 0=no
$commoncat_template=0;
//Category template end

NOTE! Set $commoncat_template=1 if you want to use common category template, otherwise leave it 0.

 

 

C) Find a line

$sts_template_file = STS_TEMPLATE_DIR . $scriptbasename . ".html";

 

Replace it with

//Category template: use different template if cPath is found

if (strpos($isacategory, "cPath") !== false) {

if ($commoncat_template =='1') { //use common category
 $sts_template_file = STS_TEMPLATE_DIR . "cPath.php.html";
} else  //use different templates 
{	//remove 'cPath='
 $splitcpath = substr($isacategory, strrpos($isacategory, 'cPath=')+6);
 //find if query string contains more
 if (strpos($splitcpath, '&') !== false) {
	 //find how many char needs to be removed from query string
	 $tmp_len=strlen($splitcpath)-strlen(substr($splitcpath, strpos($splitcpath, '&')));

	 //remove all but catID 
	 $isacatID='cPath' . substr($splitcpath, 0, $tmp_len);
 } else  //query string contains only cPath=catID, then catID=$splitcpath
 {	
	 $isacatID='cPath' . $splitcpath;
 } 
$sts_template_file = STS_TEMPLATE_DIR . $isacatID . ".php.html";      
}
} else {
       $sts_template_file = STS_TEMPLATE_DIR . $scriptbasename . ".html";
}//Category template end

 

D) Then make templates

 

If you want to use common template, create only one template and name it cPath.php.html. All categories and sub-categories uses this template.

 

If you want to use own template for each category, name them to cPath<catID>.php.html, replace <catID> according your category ID

i.e. if category ID is 17, template name is cPath17.php.html and for category ID 18 cPath18.php.html and so on...

 

For sub-categories: if a category 17 has a sub-category 20, template should be named cPath17_20.php.html, and so on. (I haven't tested sub-categories very thoroughly, but it should be ok)

 

If you do not create a template for a category, it uses the default template.

 

E) Put template(s) in your custom template directory (ie. .../includes/sts_templates/)

 

 

And that's all and now it should work... :D

 

-Terhi

Share this post


Link to post
Share on other sites

I have been using 1.8 and a few clients have mentioned a contant warning popup in https: pages that say secure and non-secure items are on this page.

 

I have looked at source and can't find any images that are http: encoded.

 

I have noticed a few post's on this thread regarding this but no real answeres, Any ideas on how to fix this?

 

Mikey..

Share this post


Link to post
Share on other sites
look at line 53, and the file it states there, copy to your server and you should be good to go

This suggestion isn't useful because the file that's missing isn't in the contribution!

 

Here's the full error:

 

Warning: main(includes/filenames.php): failed to open stream: No such file or directory in /home2/user/public_html/catalog/includes/application_top.php on line 53

 

Fatal error: main(): Failed opening required 'includes/filenames.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/user/public_html/catalog/includes/application_top.php on line 53

 

Here's the code from the 'application_top.php' that references this:

 

// include the list of project filenames

require(DIR_WS_INCLUDES . 'filenames.php');

 

 

Can anyone provide a solution? I'm having the same problem, obviously! :huh:


Affordable Web Hosting .:. http://www.croakingtoad.com/

Share this post


Link to post
Share on other sites
look at line 53, and the file it states there, copy to your server and you should be good to go

This suggestion isn't useful because the file that's missing isn't in the contribution!

It should come with oscommerce, not with the contribution. Maybe you deleted it accidentally?

Share this post


Link to post
Share on other sites
look at line 53, and the file it states there, copy to your server and you should be good to go

This suggestion isn't useful because the file that's missing isn't in the contribution!

 

Here's the full error:

 

Warning: main(includes/filenames.php): failed to open stream: No such file or directory in /home2/user/public_html/catalog/includes/application_top.php on line 53

 

Fatal error: main(): Failed opening required 'includes/filenames.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/user/public_html/catalog/includes/application_top.php on line 53

 

Here's the code from the 'application_top.php' that references this:

 

// include the list of project filenames

require(DIR_WS_INCLUDES . 'filenames.php');

 

 

Can anyone provide a solution? I'm having the same problem, obviously! :huh:

Are you installing STS over an MS 2.2 installation or another version?

 

It is designed for MS 2.2. If you are using another version, the basic header files that STS replaced may not be correct.

 

If you are using another version you should do the Advanced Install and manually put in the START/RESTART/STOP_CAPTURE commands yourself into the replaced header files.

 

- Brian


Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://forums.oscommerce.com/index.php?showtopic=58541

Share this post


Link to post
Share on other sites

Hello,

 

I am new to php and am not very good at it. I am having problems with installing your update. I did a new install on the cart, downloaded your files, and put them up in the includes/ directory. Then I updated the includes/configure.php. I then get this message:

 

Warning: main(includes/sts_restart_capture.php): failed to open stream: No such file or directory in /home/gtsweb/public_html/cat/includes/header.php on line 15

 

Fatal error: main(): Failed opening required 'includes/sts_restart_capture.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gtsweb/public_html/cat/includes/header.php on line 15

 

I see in the "includes/sts_restart_capture.php" Do I need to upload that a well? Hope you can help me. Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×