MrJoesph Posted May 2, 2008 Posted May 2, 2008 (edited) Please Help! I can't get oscms v1.1 or 2.2 to work. I can see it in the admin section and it works there but on my index page I get this at the top: $image_name){ $content_image_query = tep_db_query("select content_images_image from " . TABLE_CONTENT_IMAGES . " where content_images_name='" . $image_name . "'"); if(tep_db_num_rows($content_image_query)) { $content_image = tep_db_fetch_array($content_image_query); $result = str_replace("{".$image_name."}", tep_image(DIR_WS_CMS_IMAGES . $content_image['content_images_image']), $result); }else{ $result = str_replace("{".$image_name."}", tep_image(DIR_WS_CMS_IMAGES . NO_CMS_IMAGE), $result); } } return $result; } function tep_get_cms_content($content_name) { global $languages_id; $content_query = tep_db_query("select content_text as text from " . TABLE_CONTENT . " c, " . TABLE_CONTENT_DESCRIPTION . " cd where c.content_id=cd.content_id and content_name='" . $content_name . "' and cd.language_id='" . (int)$languages_id . "'"); if(!tep_db_num_rows($content_query)) return ''; $content = tep_db_fetch_array($content_query); $result = nl2br($content['text']); $result = tep_cms_image_replace($result); return $result; } ?> which is from the file "functions/cms.php" It looks like there is some bit of code not working. I've tried this on oscommerce 2.2ms2 and RC2a. Neither work. Can someone please help? I could lose my job over this as I have promised my boss I can do it. Also shouldn't this just be a standard feature in oscommerce. Most clients want to edit pages not just add new products and catregories. What am I missing? Is their a problem with cms.php? Thanks, Mr. Joesph Edited May 2, 2008 by MrJoesph Quote
♥geoffreywalton Posted May 2, 2008 Posted May 2, 2008 Looks like that file could be corrupted. Why not post it so people can look at it? Quote Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile Virus Threat Scanner My Contributions Basic install answers. Click here for Contributions / Add Ons. UK your site. Site Move. Basic design info. For links mentioned in old answers that are no longer here follow this link Useful Threads. If this post was useful, click the Like This button over there ======>>>>>.
MrJoesph Posted May 4, 2008 Author Posted May 4, 2008 Hi, Here's the full file: <? /* $Id: cms.php,v 1.1 2008/03/05 15:48:34 tiger Exp $ Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce.com Released under the GNU General Public License */ define('NO_CMS_IMAGE', 'noimage.gif'); function blockVars($sTpl,$beginSymbol='',$endSymbol='') { if(strlen($beginSymbol) == 0) $beginSymbol = "{"; if(strlen($endSymbol) == 0) $endSymbol = "}"; $beginSymbolLength = strlen($beginSymbol); $endTag = 0; /* searching open symbol */ while (($beginTag = strpos($sTpl,$beginSymbol,$endTag)) !== false) { /* searching close symbol */ if (($endTag = strpos($sTpl,$endSymbol,$beginTag)) !== false) { /* add variable name to the array of variable */ $vars[] = substr($sTpl, $beginTag + $beginSymbolLength, $endTag - $beginTag - $beginSymbolLength); } } /* if there is one or more variable in array then return this array */ if(isset($vars)) return $vars; else return false; } function tep_cms_image_replace($content_text) { $result = $content_text; $vars = blockVars($result); if($vars) foreach($vars as $key => $image_name){ $content_image_query = tep_db_query("select content_images_image from " . TABLE_CONTENT_IMAGES . " where content_images_name='" . $image_name . "'"); if(tep_db_num_rows($content_image_query)) { $content_image = tep_db_fetch_array($content_image_query); $result = str_replace("{".$image_name."}", tep_image(DIR_WS_CMS_IMAGES . $content_image['content_images_image']), $result); }else{ $result = str_replace("{".$image_name."}", tep_image(DIR_WS_CMS_IMAGES . NO_CMS_IMAGE), $result); } } return $result; } function tep_get_cms_content($content_name) { global $languages_id; // 20080305 itx freddy modified the where to verify content_status = '1' $content_query = tep_db_query("select content_text as text from " . TABLE_CONTENT . " c, " . TABLE_CONTENT_DESCRIPTION . " cd where c.content_status = '1' and c.content_id=cd.content_id and content_name='" . $content_name . "' and cd.language_id='" . (int)$languages_id . "'"); if(!tep_db_num_rows($content_query)) return ''; $content = tep_db_fetch_array($content_query); $result = nl2br($content['text']); $result = tep_cms_image_replace($result); return $result; } // 20080305 itx freddy new function to get the title function tep_get_cms_title($content_name) { global $languages_id; $content_query = tep_db_query("select content_title as title from " . TABLE_CONTENT . " c, " . TABLE_CONTENT_DESCRIPTION . " cd where c.content_status = '1' and c.content_id=cd.content_id and content_name='" . $content_name . "' and cd.language_id='" . (int)$languages_id . "'"); if(!tep_db_num_rows($content_query)) return ''; $content = tep_db_fetch_array($content_query); return $content['title']; } ?> The code from line 40 onwards gets displayed at the top of the index page: if($vars) foreach($vars as $key => $image_name){ Any help appreciated. Thanks Quote
♥geoffreywalton Posted May 4, 2008 Posted May 4, 2008 Not being a real whizzzz http://www.w3schools.com/PHP/php_looping.asp I'd try removing if($vars) Then have a look a other versions and see if they have some extra coding there which needs to be there or the last contribution just messed up. If it is not needed then it would be nice if you updated the contribution for the next person so they don't lose their job. Quote Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile Virus Threat Scanner My Contributions Basic install answers. Click here for Contributions / Add Ons. UK your site. Site Move. Basic design info. For links mentioned in old answers that are no longer here follow this link Useful Threads. If this post was useful, click the Like This button over there ======>>>>>.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.