DE - Allgemeiner SupportTopnews und Headlines nur auf der News Page anzeigen lassen wie?


24.04.2011, 13:33 - Mr.Smithers-91 - webSPELL user - 426 Posts
Hallo webSPELL-Community,

ich bin leider net so der PHP Profi, kannte den Code aber hab ihn irgendwo verloren. Undzwar suche ich diese if-Abfrage die es mir ermöglicht beispielsweise die Topnews und die sc_headlines nur auf der Newspage anzeigen zu lassen.

Also hier mal ein Abschnitt meiner Seite. (Contentbereich)

Code:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
<div id="maincontent">
                           <div style="width:50%; height:auto; float:left;"><?php include("sc_topnews.php"); ?></div>
                           <div style="width:50%; height:auto; float:left;"><?php include("sc_headlines.php"); ?></div>
                            <div><?php
                                   if(!isset($site)) $site="news";
                                   $invalide = array('\\','/','/\/',':','.');
                                   $site = str_replace($invalide,' ',$site);
                                   if(!file_exists($site.".php")) $site = "news";
                                   include($site.".php");
                                   ?></div>
                            <div id="advertisement" style="margin-top:50px;"><?php include("sc_bannerrotation.php"); ?></div>
                            </div>
                           <!--maincontent end-->


Wäre nett wenn es gleich jemand so reinbringt, dass es gleich funzt.


Vielen Dank!


MFG
Mr.Smithers-91
 
24.04.2011, 16:28 - Sysix - webSPELL lover - 1156 Posts
Code:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
<div id="maincontent">
                           <?php if($_GET['site'] == 'news' OR $_GET['site'] == '') { ?>
<div style="width:50%; height:auto; float:left;"><?php include("sc_topnews.php"); ?></div>
                           <div style="width:50%; height:auto; float:left;"><?php include("sc_headlines.php"); ?></div>
<?php } ?>
                            <div><?php
                                   if(!isset($site)) $site="news";
                                   $invalide = array('\\','/','/\/',':','.');
                                   $site = str_replace($invalide,' ',$site);
                                   if(!file_exists($site.".php")) $site = "news";
                                   include($site.".php");
                                   ?></div>
                            <div id="advertisement" style="margin-top:50px;"><?php include("sc_bannerrotation.php"); ?></div>
                            </div>
                           <!--maincontent end-->


natürlich kannst du auch statt get die variabel benutzten. aber so bin ich mir immer 100% sicher amüsiert

MFG Sysix

[url=http://sysix-coding.de]Sysix-Coding | Free Webspell Addons and more...[/url]

 
24.04.2011, 16:55 - Mr.Smithers-91 - webSPELL user - 426 Posts
Vielen Dank!

Läuft wunderbar!