Zen Cart Logo
Forums / All Other Contributions/Addons / template_func.php not working on custom template front page

template_func.php not working on custom template front page

Locked

Views: 1,370

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
30 Jul 2008, 9:17 AM
#1
bazfr avatar

bazfr

New Zenner

Join Date:
Sep 2007
Posts:
43
Plugin Contributions:
0

template_func.php not working on custom template front page

Hi,
I've installed a custom template which is using some sort of override setting to force automatic buttons instead of static image buttons. i want to use static image buttons.
In order to do so i had to remove or replace the following 2 functions: az_tep_image and az_tep_image_submit from /includes/templates/ZC…../common/tpl_main_page.php. since i've done that, i get the following error on my front page:
Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 0 in /home/fhlinux144/e/efs-pro.fr/user/htdocs/includes/classes/template_func.php on line 60

Apparently this concerns [function.preg-match]?
I checked my server info and PCRE (Perl Compatible Regular Expressions) Support has been enabled.

I then started looking through the forum i found the following Thread:
http://www.zen-cart.com/forum/showthread.php?t=46691
Here i found a solution, but i'm a bit worried about the solution that i have found!!

I replaced the following code inside: includes/classes/template_func.php

lines 57-60 1.3.5 version:

$file_pattern = '/'.$file_pattern.'$/';
if ($mydir = @dir($file_dir)) {
  while ($file = $mydir->read()) {
    if (preg_match($file_pattern, $file)) 

to

lines 57-60 1.3.0 version:

if ($mydir = @dir($file_dir)) {
  while ($file = $mydir->read()) {
    if ( strstr($file, $file_pattern) ) {

Why i'm i worried? Well i'm using an older version, will this effect other parts of my shop, do i need to use another solution?

Could someone please give me their opinion?

cheers

baz°:unsure:

3 Aug 2008, 1:17 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: template_func.php not working on custom template front page

If you're using an addon that's using tep_xxxxx functions, that code is designed for an Other Shopping Cart, not Zen Cart ... thus you have an incompatibility problem. Simply renaming or replacing those functions is not likely going to fully resolve your compatibility issues.

I suggest you talk to whomever you obtained your addon from.

Moving this out of the Bug Reports section, because your bug is not a Zen Cart core problem.*

BTW ... it's strongly NOT recommended to mix old and new versions of code together. You just might end up creating security problems by using older code in newer versions.