如何在特定页面中显示url dans中的特定元素?

时间:2017-02-13 19:58:30

标签: php

我有这些网址:

http://......com/boutique/index.php?Blog&Content&blog_content_id=2
http://......com/boutique/index.php?Products&Specials
http://......com/boutique/index.php?Products&Description&products_id=2
http://......com/boutique/index.php?Info&Contact
http://......com/boutique/index.php?Info&Contact&Success
http://......com/boutique/index.php?cPath=7_36
http://......com/boutique/index.php

我想只取一个或几个元素并显示在目录中。 管理中选择了特定页面  示例

index.php
Blog&Content
Products&Specials
cPath=7_36

我试过了但是效果不好。 在我的代码下面

        if ( class_exists($class) ) {
          $mb = new $class();

// Dynamic template
          if(!isset($mb->pages) && ($mb->isEnabled())){
            $this->pages = 'all'; //########## Display in all page the elements
            $mb->execute(); // ##############  work fine
          } else {


    // hide or display the box left / right - explode the element selected
            $page = (explode(';' , $mb->pages));  
    // example of return $page after a var_dump
    // array(2) { [0]=> string(12) "Blog&Content" [1]=> string(0) "" } 
    //array(1) { [0]=> string(3) "all" } array(1) { [0]=> string(3) "all" } 
    //array(1) { [0]=> string(3) "all" } array(1) { [0]=> string(3) "all" } 
    //array(2) { [0]=> string(9) "index.php" [1]=> string(0) "" } 



            if( ($mb->isEnabled() && $mb->pages == 'all') ) {
              $mb->execute(); //############ display all element in all the pages
            } else {
              if( ($mb->isEnabled() && $mb->pages == true) ) {
                $string = $_SERVER['QUERY_STRING']; 

//var_dump(in_array($string , $page));

                if (in_array($string , $page) == true) {
                  if (!empty(in_array('index.php' , $page))) {
                    $mb->execute(); //############ display the element in a specifics pages
                  } else {
                    $mb->notEnabled; //############ not display the page
                  }
                }
              }
           }
        }

0 个答案:

没有答案