suggs Posted March 8, 2004 Share Posted March 8, 2004 Hi there, I understand that include(DIR_WS_BOXES . 'categories.php'); takes includes/boxes/categories.php and parses/formats it using ../classes/boxes.php my question: is there a quick way of echoing the main categories (...or the contents of other boxes) without having to tweak and/or ruin boxes.php? something like: include(WHATEVEROPTION . 'categories.php'); or something even easier..? thanks a lot i.a Link to comment Share on other sites More sharing options...
suggs Posted March 9, 2004 Author Share Posted March 9, 2004 *ahem...* I got as far as tep_get_categories Could this be it? If yes: (how) can I make it spit out the main categories? Link to comment Share on other sites More sharing options...
suggs Posted March 9, 2004 Author Share Posted March 9, 2004 as I keep on talking to myself, I might as well present myself the solution: (1.) throw the following main_categories.php into includes/modules/: <? // main_categories.php start $query_cat = tep_db_query("select * from " . TABLE_CATEGORIES . " order by categories_id") or die ("query failed"); $query_cat_desc = tep_db_query("select * from " . TABLE_CATEGORIES_DESCRIPTION . " order by categories_id") or die ("query failed"); $num = mysql_num_rows($query_cat); for ($i=0; $i<$num; $i++) { $parent_id = mysql_result($query_cat, $i, "parent_id"); $categories_name = mysql_result($query_cat_desc, $i, "categories_name"); $categories_id = mysql_result($query_cat_desc, $i, "categories_id"); if($parent_id == 0) print "<a href=\"index.php?cPath=$categories_id\" class=\"bg_red\">$categories_name</a> \n"; } mysql_close(); // main_categories.php end ?> (2.) add the following line to includes/filenames.php: define('FILENAME_MAIN_CATEGORIES', 'main_categories.php'); Now you are ... I mean: now I AM ready to include the main categories anywhere I want just by including this: <?php include(DIR_WS_MODULES . FILENAME_MAIN_CATEGORIES); ?> Link to comment Share on other sites More sharing options...
suggs Posted March 9, 2004 Author Share Posted March 9, 2004 Wow, that's just what I was looking for! Thanks! ;) Link to comment Share on other sites More sharing options...
burt Posted March 9, 2004 Share Posted March 9, 2004 It's madness talking to yourself you know. Link to comment Share on other sites More sharing options...
suggs Posted March 9, 2004 Author Share Posted March 9, 2004 Oh, I hear voices ... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.