X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Images cached by browser (https://forum.x-cart.com/showthread.php?t=6675)

Light Speed 03-11-2004 11:46 PM

Images cached by browser
 
How can I make the images be cached by the users browser so they don't have to download every time a user goes back to a page? Is this a setting in config.php?

I only want the images to download if the image is new.

Light Speed 03-17-2004 12:50 PM

*Bump*

Anybody? :oops:

groovico 03-17-2004 03:54 PM

Make sure you have your x-cart set to store images in the filesystem not the database.

3.4.3 and over will use proper image URLS so the browser will cache.

If you are storing in the database it will download the files everytime.

Light Speed 03-17-2004 05:18 PM

Sorry. I did a little digging and it's only the subcategory icons that are not caching. I'm using the mod to allow images for subcategories so they get urls like
Code:

http://www.strangemonster.com/store/icon.php?categoryid=23

Looks like I need to find a way to make them read to the actual file to have them cache.

groovico 03-18-2004 11:57 AM

Yup you're right about that part, they missed out the URL stuff for that area for some reason.

Light Speed 03-28-2004 07:12 PM

What can I do to the code to make it work to allow caching?

The mod code looks like this:
Code:

{* ==================== Sub categories mod start *}
{section name=cat_num loop=$subcategories}
{ if %cat_num.first% }
{if $tmp} [img]{if $current_category.icon_url}{$current_category.icon_url}{else}../icon.php?categoryid={$cat}{/if}[/img] {/if}
<table width="75%" border="0" align="center" cellpadding="5" cellspacing="0">
{/if}
{ if %cat_num.index% is div by 3}
<tr>
{/if}
<td align="center" valign="top">
<a href="home.php?cat={ $subcategories[cat_num].categoryid }">
[img]../icon.php?categoryid={$subcategories[cat_num].categoryid}[/img]

 

<font class="ItemsList">{ $subcategories[cat_num].category|escape }</font>
{if $config.Appearance.count_products eq "Y"}
? ?{if $subcategories[cat_num].product_count}
 
? ?({ $subcategories[cat_num].product_count } Products)
? ?{elseif $subcategories[cat_num].subcategory_count}
({ $subcategories[cat_num].subcategory_count } Subcategories)</a>
? ?{/if}
{/if}

</td>
{ if %cat_num.last% }
</tr>
</table>
{/if}
{/section}

{* ==================== Sub categories mod end *}


So they are calling the subcat icons with this line:
[img]../icon.php categoryid={$subcategories[cat_num].categoryid}[/img]


And I want the browser to cache the image so I guess I need the code to be written to the page as a true url to the image.


How can I do that?
Do have to make a new tpl file for the sub cat icons that functions like the product_thumbnail.tpl file? Is that what generates the true urls for the thumbnails? How would I implement that?

Light Speed 04-01-2004 08:51 PM

*Bump* anybody?

TelaFirma 04-02-2004 05:45 AM

Well.... You will need to make a new .tpl file based on the product_thumbnail.tpl file. Probably call it cat_icon.tpl....

You will also need to add a function to the func.php file to read the file path from the 'icons' table, and call this function from within the categories.php file and add the results to the $subcategory array.

After you do this, you can call the icon in a similar way that you do with the thumbnails.. ie. {include file="cat_icon.tpl" categoryid=$subcategories[cat_num].categoryid icon_url=$subcategories.icon_url}

Light Speed 04-02-2004 11:43 AM

Quote:

Originally Posted by TelaFirma
Well.... You will need to make a new .tpl file based on the product_thumbnail.tpl file. Probably call it cat_icon.tpl....

You will also need to add a function to the func.php file to read the file path from the 'icons' table, and call this function from within the categories.php file and add the results to the $subcategory array.

After you do this, you can call the icon in a similar way that you do with the thumbnails.. ie. {include file="cat_icon.tpl" categoryid=$subcategories[cat_num].categoryid icon_url=$subcategories.icon_url}


Thanks!! That totally points me in the right direction :)


All times are GMT -8. The time now is 09:14 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.