Avatar billede step Nybegynder
18. juli 2007 - 19:26 Der er 3 kommentarer

Include layout

Hejsa!

Jeg er lige blevet færdig med min blog, hvor jeg gerne vil have der skal vises bannere øverst på siden midt i.

Scriptet som jeg skal bruge har jeg og det fungerer helt fint. Der stod i scriptet at jeg skulle indsætte denne kode:

include $_SERVER["DOCUMENT_ROOT"] . "/ad/display2.php";

Der hvor jeg gerne ville have at de forskellige bannere, så skulle vises.

Jeg har også fået det til, at virke og det hele, men kan ikke finde ud af hvordan jeg får den ovennævnte "include" øverst midt på siden. Altså så de forskellige bannere bliver vist midt på siden øverst oppe.

Lige nu virker det kun når koden bliver indsat nederst i min index.php.

Hvordan får jeg scriptet til og vises midt på siden - øverst oppe?
Avatar billede oldnick Nybegynder
18. juli 2007 - 19:56 #1
Umiddelbart skal du jo bare smide den i toppen. Men det ville være nemmer at svare på hvis du kunne vise din kode på index.php?

Det med at få det vist midt på siden er jo nok et css spg.!
Avatar billede step Nybegynder
18. juli 2007 - 20:02 #2
Index.php ser sådan her ud:

<?php

  include ("./inc/param.inc.php");
  include_once (CORE_ROOT."inc/forum.functions.inc.php");
 
if ($_SESSION['user_info'] or $_COOKIE['session_vars']) auth_user($sm);

  $lng[0] = $lang."eportal";

  if ($rq['rw']){ // extract parameters from rewrited urls
      foreach ($rq['rw'] as $value){
      preg_match("/([a-zA-Z]*)([0-9\.]*)/",$value,$m);
      $rq[$m[1]] =$m[2];
      }
  }

  if (array_search($rq['a'],$links) == "feed"){ // xml feed

      define("CORE_PAGE",true);
      include (CORE_ROOT."inc/pages/core_feed.inc.php");

  }elseif(array_search($rq['a'],$links) == "adminpanel"){ // admin panel

      if (!count($_SESSION['user_info']['priv']) or $_SESSION['user_info']['priv'][0] == "none") redirect ();

      if (!@in_array($priv[$rq['p']],$_SESSION['user_info']['priv']) and $rq['p']) $rq['p'] = "restrict"; // check privileges for logged user

      define('ADMIN_PANEL',true);
      $admin_section = CORE_ROOT."inc/pages/admin_".$rq['p'].".inc.php";

      if (file_exists($admin_section)){
          include($admin_section);
      }else{
          include(CORE_ROOT."inc/pages/admin_index.inc.php");
      }

      $sm->assign(array("admin_section"=>$admin_section,"priv"=>$priv));
      $contentfile = "core_adminpanel.tpl";

  }elseif (array_key_exists($rq['a'],$custom_pages)){ // custom pages

      $page_content = $my->get_line ("select pagecontent from ".TBL_PF."custompages where path='".$rq['a']."' limit 0,1","k");
      $sm->assign("page_content",$page_content);
      $contentfile = "mods_custompage.tpl";

  }elseif(in_array($rq['a'],$links) // forums pages
            and $rq['a'] != $links['readmore']
            and $rq['a'] != $links['viewnews']
            and $rq['a'] != $links['friend']
            and $rq['a'] != $links['contact']
            and $rq['a'] != $links['downloads']
            and !$rq['confirmmail'])
  {

      if ($rq['a'] !="topic" and $rq['a'] != "reply" and $_SESSION['viewtopic']) unset($_SESSION['viewtopic']);
      if ($rq['a'] !="topic" and $_SESSION['errreply']) unset($_SESSION['errreply']); // back to topic page if attempt to post empty message

      if ($_SESSION['query'] and $rq['a'] != $links['search'] ) unset($_SESSION['query']);
      if ($rq['a'] != $links['user']) unset($_SESSION['uposts']);

      // remove member list session
      if ($_SESSION['memlist'] and $rq['a'] != $links['members']) unset ($_SESSION['memlist']);

      define("FORUM_PAGES",true);

      $page_key = array_search($rq['a'],$links);
      include (CORE_ROOT."inc/pages/forum_".$page_key.".inc.php");

  }else{ // another pages .......

        if ($rq['confirmmail']) $rq['a'] = "confirmemail";

        define("CORE_PAGE",true);

        $page_key = array_search($rq['a'],$links);

        if (!$page_key and $rq['confirmmail']){
            $page_key = "confirmemail";

        }elseif (!$page_key){
          $page_key = "index";
        }

          include (CORE_ROOT."inc/pages/core_".$page_key.".inc.php");
          $sm->assign("set",$set);
  }

    // check new private messages for logged user
    if ($forum_private_messages and $_SESSION['user_info']['uid']>0)  $priv_mess_cnt = $my->get_line ("select count(pmid) from ".TBL_PF."frm_privmess  where pmuidto='".$_SESSION['user_info']['uid']."' and pmtobox ='i'","k");

    $sm->assign(array("contentfile"=>$contentfile,"lng"=>$lng,"priv_messages"=>$forum_private_messages,"priv_mess_cnt"=>$priv_mess_cnt));

/// load additional blocks ..........

    define ('MODULE_FILE',true);

    $bvis [] = "all";

    if (count($_SESSION['user_info']['priv']) and  $_SESSION['user_info']['priv'][0] !="none") {
        $bvis [] = "adm";
        $bvis [] = "reg";
    }elseif ($_SESSION['user_info']['ustatus']) {
        $bvis [] = "reg";
    }elseif (!$_SESSION['user_info']['ustatus']) {
        $bvis [] = "ano";
    }
    $w_clause = " or bvisible='".join("' or bvisible='",$bvis)."' ";

    $blocks = $my->get_array_a("select btype,bname,bcontent from ".TBL_PF."blocks where bstatus='1' and ( bvisible='all' $w_clause ) order by position asc");

      foreach ($blocks as $blocks_info){
        if ($blocks_info['bname']){
          if ($blocks_info['btype'] =="t") {
              $blocks_list[$blocks_info['bname']] .= $blocks_info['bcontent'];

          }elseif ($blocks_info['btype'] =="f" and file_exists(CORE_ROOT.FLD_MODULES.$blocks_info['bcontent']."/index.php")){

                include (CORE_ROOT.FLD_MODULES.$blocks_info['bcontent']."/index.php");
                $blocks_list[$blocks_info['bname']] .= $module_result;
          }

        }
      }
      if (count($blocks)) $sm->assign($blocks_list);

    $sm->display("core_body.tpl");

include $_SERVER["DOCUMENT_ROOT"] . "/ad/display2.php";

?>
Avatar billede cronick Nybegynder
18. juli 2007 - 22:36 #3
Vil tro at dette ville hjælpe på det..

<?php

  include ("./inc/param.inc.php");
  include_once (CORE_ROOT."inc/forum.functions.inc.php");
 
  # Her henter den så disse bannere (samt centre dem)
    echo "<center>";
    include $_SERVER["DOCUMENT_ROOT"] . "/ad/display2.php";
    echo "</center>";

if ($_SESSION['user_info'] or $_COOKIE['session_vars']) auth_user($sm);

  $lng[0] = $lang."eportal";

  if ($rq['rw']){ // extract parameters from rewrited urls
      foreach ($rq['rw'] as $value){
      preg_match("/([a-zA-Z]*)([0-9\.]*)/",$value,$m);
      $rq[$m[1]] =$m[2];
      }
  }

  if (array_search($rq['a'],$links) == "feed"){ // xml feed

      define("CORE_PAGE",true);
      include (CORE_ROOT."inc/pages/core_feed.inc.php");

  }elseif(array_search($rq['a'],$links) == "adminpanel"){ // admin panel

      if (!count($_SESSION['user_info']['priv']) or $_SESSION['user_info']['priv'][0] == "none") redirect ();

      if (!@in_array($priv[$rq['p']],$_SESSION['user_info']['priv']) and $rq['p']) $rq['p'] = "restrict"; // check privileges for logged user

      define('ADMIN_PANEL',true);
      $admin_section = CORE_ROOT."inc/pages/admin_".$rq['p'].".inc.php";

      if (file_exists($admin_section)){
          include($admin_section);
      }else{
          include(CORE_ROOT."inc/pages/admin_index.inc.php");
      }

      $sm->assign(array("admin_section"=>$admin_section,"priv"=>$priv));
      $contentfile = "core_adminpanel.tpl";

  }elseif (array_key_exists($rq['a'],$custom_pages)){ // custom pages

      $page_content = $my->get_line ("select pagecontent from ".TBL_PF."custompages where path='".$rq['a']."' limit 0,1","k");
      $sm->assign("page_content",$page_content);
      $contentfile = "mods_custompage.tpl";

  }elseif(in_array($rq['a'],$links) // forums pages
            and $rq['a'] != $links['readmore']
            and $rq['a'] != $links['viewnews']
            and $rq['a'] != $links['friend']
            and $rq['a'] != $links['contact']
            and $rq['a'] != $links['downloads']
            and !$rq['confirmmail'])
  {

      if ($rq['a'] !="topic" and $rq['a'] != "reply" and $_SESSION['viewtopic']) unset($_SESSION['viewtopic']);
      if ($rq['a'] !="topic" and $_SESSION['errreply']) unset($_SESSION['errreply']); // back to topic page if attempt to post empty message

      if ($_SESSION['query'] and $rq['a'] != $links['search'] ) unset($_SESSION['query']);
      if ($rq['a'] != $links['user']) unset($_SESSION['uposts']);

      // remove member list session
      if ($_SESSION['memlist'] and $rq['a'] != $links['members']) unset ($_SESSION['memlist']);

      define("FORUM_PAGES",true);

      $page_key = array_search($rq['a'],$links);
      include (CORE_ROOT."inc/pages/forum_".$page_key.".inc.php");

  }else{ // another pages .......

        if ($rq['confirmmail']) $rq['a'] = "confirmemail";

        define("CORE_PAGE",true);

        $page_key = array_search($rq['a'],$links);

        if (!$page_key and $rq['confirmmail']){
            $page_key = "confirmemail";

        }elseif (!$page_key){
          $page_key = "index";
        }

          include (CORE_ROOT."inc/pages/core_".$page_key.".inc.php");
          $sm->assign("set",$set);
  }

    // check new private messages for logged user
    if ($forum_private_messages and $_SESSION['user_info']['uid']>0)  $priv_mess_cnt = $my->get_line ("select count(pmid) from ".TBL_PF."frm_privmess  where pmuidto='".$_SESSION['user_info']['uid']."' and pmtobox ='i'","k");

    $sm->assign(array("contentfile"=>$contentfile,"lng"=>$lng,"priv_messages"=>$forum_private_messages,"priv_mess_cnt"=>$priv_mess_cnt));

/// load additional blocks ..........

    define ('MODULE_FILE',true);

    $bvis [] = "all";

    if (count($_SESSION['user_info']['priv']) and  $_SESSION['user_info']['priv'][0] !="none") {
        $bvis [] = "adm";
        $bvis [] = "reg";
    }elseif ($_SESSION['user_info']['ustatus']) {
        $bvis [] = "reg";
    }elseif (!$_SESSION['user_info']['ustatus']) {
        $bvis [] = "ano";
    }
    $w_clause = " or bvisible='".join("' or bvisible='",$bvis)."' ";

    $blocks = $my->get_array_a("select btype,bname,bcontent from ".TBL_PF."blocks where bstatus='1' and ( bvisible='all' $w_clause ) order by position asc");

      foreach ($blocks as $blocks_info){
        if ($blocks_info['bname']){
          if ($blocks_info['btype'] =="t") {
              $blocks_list[$blocks_info['bname']] .= $blocks_info['bcontent'];

          }elseif ($blocks_info['btype'] =="f" and file_exists(CORE_ROOT.FLD_MODULES.$blocks_info['bcontent']."/index.php")){

                include (CORE_ROOT.FLD_MODULES.$blocks_info['bcontent']."/index.php");
                $blocks_list[$blocks_info['bname']] .= $module_result;
          }

        }
      }
      if (count($blocks)) $sm->assign($blocks_list);

    $sm->display("core_body.tpl");

?>
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester