开发者

using CMS to open page

this is the index.php

 <table align="center" border="0" cellpadding="0" cellspacing="0">
        <tbody>
          <?php include 'header.php'; ?>
          <tr>
         <td class="row_2">
         <!-- header_eof //-->
         <!-- body //-->
           <table class="main_table" border="0" cellpadding="0" cellspacing="0">
          <tbody>
            <tr>
           <?php
            if($cond)
             include 'left.php'; ?>
           <!-- body_text //-->
           <?php get_page(); ?>
           <!-- body_text_eof //-->
           <?php
            if($cond)
             include 'right.php'; ?>
            </tr>
            <tr>
            <?php
            if(!$cond)
             include 'contents/contact_us.php';?>
            </tr>
          </tbody>
           </table>
         <!-- body_eof //-->
         <!-- footer //-->
         </td>
          </tr> 
          <?php include 'footer.php'; ?>
        </tbody>
         </table>

This is header.php . I have created link from database

 <?php
                       $menus = db_query("select * from menus where type=0 order by weight");
          $sr = 0;
          while($menu = mysql_fetch_object($menus)) { ?>
          <?php if(($sr++) > 0){ ?>
          <td class="menu_separator"><img src="<?php echo SROOT;?>images/menu_separator.png" alt="" class="png" width="2" border="0" height="49"></td>
          <?php } ?>
          <td id="<?php echo get_id($menu->page_name); ?>" <?php echo get_event($menu->page_name); ?> onClick="document.location='<?php echo SROOT . $menu->page_name;?>'" nowrap="nowrap"><?php echo $menu->title; ?></td>
          <?php } ?>

this is the get_page function

开发者_StackOverflow社区
function get_page() {
 $page = arg(0);
 $page = (empty($page)) ? 'home' : $page;
 $cat  = db_query("select * from mb_category where title='".$page."'");
 $page = (mysql_num_rows($cat)) ? 'brands' : $page;
 include 'contents/'. $page .'.php';
}

I have everything in the right place.The same code is working for my friend but we are unable to understand the problem here. I get error cannot find page. His is working fine.

When i click link it says cannot find page..but his goes to page

Can anyone please help and tell me what i am doing wrong


Edited:

The part I don't understand is this:

 $page = arg(0);
 $page = (empty($page)) ? 'home' : $page;
 $cat  = db_query("select * from mb_category where title='".$page."'");

What is "arg(0)?, so how do you get $page?

Ok, I understand this is a drupal function or alike.

But, pls, verify that arg(0) returns sth.

If you are not sure of the path the include is taken, I would change this line:

 include 'contents/'. $page .'.php';

for:

include $_SERVER["DOCUMENT_ROOT"]."/contents/'. $page .'.php';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜