Guest Posted October 10, 2005 Share Posted October 10, 2005 Hi! I have a problem with a FAQ.php file. There I have a contents table, with links to different sections (in the same page), as you can see here. But when I click on those links it takes me to index.php. What do I have to change to be correct? This is the faq.php file: <?php require('includes/application_top.php'); define('IN_COPPERMINE', true); define('FAQ_PHP', true); global $CONFIG; require('include/init.inc.php'); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td> <?php // ------------------------------------------------------------------------- // // Coppermine Photo Gallery 1.3.1 // // ------------------------------------------------------------------------- // // Copyright © 2002-2004 Gregory DEMAR // // http://www.chezgreg.net/coppermine/ // // ------------------------------------------------------------------------- // // Updated by the Coppermine Dev Team // // (http://coppermine.sf.net/team/) // // see /docs/credits.html for details // // ------------------------------------------------------------------------- // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // ------------------------------------------------------------------------- // // CVS version: $Id: faq.php,v 1.2 2004/07/09 06:57:34 gaugau Exp $ // ------------------------------------------------------------------------- // // build the ouput $faqHeading = ''; $faqContent = ''; $anchorName = ''; foreach($lang_faq_data as $element) { if ((is_array($element))) { if ($CONFIG[$element[2]] == $element[3]) { $anchorName = createAnchorName($element[0]); $faqHeading .= '<ul style="margin-top:0px;margin-bottom:0px"><li><a href="#'.$anchorName.'">'.$element[0].'</a></li></ul>'; $faqContent .= '<tr><td class="tablef"><i>'.$lang_faq_php['question'].'</i><a name="'.$anchorName.'"></a><b>'.$element[0].'</b></td></tr><tr><td class="tableb"><i>'.$lang_faq_php['answer'].'</i>'.$element[1].'<br /> <br /> <br /></td></tr>'; } } else { $anchorName = createAnchorName($element); $faqHeading .= '<h2><a href="#'.$anchorName.'">'.$element.'</a></h2>'; $faqContent .= '<tr><td class="tableh1"><a name="'.$anchorName.'"></a><h2>'.$element.'</h2></td></tr>'; } } $faqHeading .= ''; //print $faqHeading; //print '<hr>'; //print $faqContent; pageheader($lang_faq_php['faq']); print '<h1>'.$lang_faq_php['faq'].'</h1>'; starttable('100%',$lang_faq_php['toc']); print '<tr>'; print '<td class="tableb">'; print $faqHeading; print '</td>'; print '</tr>'; endtable(); print '<br /> <br />'; starttable('100%'); print $faqContent; endtable(); print '<br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />'; pagefooter(); ob_end_flush(); function createAnchorName($anchor) { $anchor = trim(str_replace(' ','_',str_replace('?','',$anchor))); return $anchor; } ?> </td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td> </td> </tr> </table></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Thanks in advance! Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted October 10, 2005 Share Posted October 10, 2005 you need to tell the anchor to stay on the same page ... look at my example: <a href="' . basename($PHP_SELF) . '#Ordering">Ordering/Changing quantities</a><br> :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ... Link to comment Share on other sites More sharing options...
Guest Posted October 10, 2005 Share Posted October 10, 2005 Thank you so much...But could you be more specific? I don't have a clue how to adapt that to what I need. Please don't be annoyed by my lack of knowledge! :) Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted October 10, 2005 Share Posted October 10, 2005 Thank you so much...But could you be more specific? I don't have a clue how to adapt that to what I need. Please don't be annoyed by my lack of knowledge! :) find this else { $anchorName = createAnchorName($element); $faqHeading .= '<h2><a href="#'.$anchorName.'">'.$element.'</a></h2>'; $faqContent .= '<tr><td class="tableh1"><a name="'.$anchorName.'"></a><h2>'.$element.'</h2></td></tr>'; replace by this (we only change the heading part) else { $anchorName = createAnchorName($element); $faqHeading .= '<h2><a href="' . basename($PHP_SELF) . '#'.$anchorName.'">'.$element.'</a></h2>'; $faqContent .= '<tr><td class="tableh1"><a name="'.$anchorName.'"></a><h2>'.$element.'</h2></td></tr>'; :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ... Link to comment Share on other sites More sharing options...
Guest Posted October 10, 2005 Share Posted October 10, 2005 Thanks, but that doesn't seem to be it....It still goes to whta my index says. In the browser I have the correct path: http://muccelmic.com/muccelmic/#Why_do_I_need_to_register but it displays the mainpage content. See for yourself if you have the time: here. See what happens when you press Why_do_I_need_to_register. Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted October 10, 2005 Share Posted October 10, 2005 Thanks, but that doesn't seem to be it....It still goes to whta my index says. In the browser I have the correct path: http://muccelmic.com/muccelmic/#Why_do_I_need_to_register but it displays the mainpage content. See for yourself if you have the time: here. See what happens when you press Why_do_I_need_to_register. the general FAQ link works already ... I didn#t notice you had code for 2 different anchors, sorry ... anyway find this foreach($lang_faq_data as $element) { if ((is_array($element))) { if ($CONFIG[$element[2]] == $element[3]) { $anchorName = createAnchorName($element[0]); $faqHeading .= '<ul style="margin-top:0px;margin-bottom:0px"><li><a href="#'.$anchorName.'">'.$element[0].'</a></li></ul>'; $faqContent .= '<tr><td class="tablef"><i>'.$lang_faq_php['question'].'</i><a name="'.$anchorName.'"></a><b>'.$element[0].'</b></td></tr><tr><td class="tableb"><i>'.$lang_faq_php['answer'].'</i>'.$element[1].'<br /> <br /> <br /></td></tr>'; } and replace by this foreach($lang_faq_data as $element) { if ((is_array($element))) { if ($CONFIG[$element[2]] == $element[3]) { $anchorName = createAnchorName($element[0]); $faqHeading .= '<ul style="margin-top:0px;margin-bottom:0px"><li><a href="' . basename($PHP_SELF) . '#'.$anchorName.'">'.$element[0].'</a></li></ul>'; $faqContent .= '<tr><td class="tablef"><i>'.$lang_faq_php['question'].'</i><a name="'.$anchorName.'"></a><b>'.$element[0].'</b></td></tr><tr><td class="tableb"><i>'.$lang_faq_php['answer'].'</i>'.$element[1].'<br /> <br /> <br /></td></tr>'; } :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ... Link to comment Share on other sites More sharing options...
Guest Posted October 10, 2005 Share Posted October 10, 2005 Thank you so very very much. You are nice, you know?:) It works now! Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted October 10, 2005 Share Posted October 10, 2005 Thank you so very very much. You are nice, you know?:) It works now! you're welcome! I sure remember my headaches when I first worked on this :thumbsup: :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.