Icludes in Modul

Gesperrt
KrissKrass
Beiträge: 86
Registriert: Mi 2. Jun 2004, 16:01
Wohnort: Bochum
Kontaktdaten:

Icludes in Modul

Beitrag von KrissKrass »

Hallo zusammen,

ich habe folgendes Problem: In einem Container möchte ich über ein Modul die gesammte rechte Leiste meiner Website integrieren. Soweit so gut, jedoch möchte ich in diesem Modul einige Dateien per "PHP-Include" einfügen, wie z.B.: Forum Login, Last Topics u.s.w.!
Also habe ich die die erste Datei in das Modul eingefügt wie folgt:

Code: Alles auswählen

<table width="204" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td> 
      <div align="right"><img src="images/header/space.gif" width="205" height="10" alt="Space"><br>
        <img src="images/rightcontent/content/headlines/termin.gif" width="205" height="20" alt="_Termin!"></div>
    </td>
  </tr>
  <tr> 
    <td valign="top" align="center"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="7">
        <tr> 
          <td> 
            <p>&nbsp;</p>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td> 
      <div align="right"><img src="images/rightcontent/content/headlines/community.gif" width="205" height="20" alt="_Community"></div>
    </td>
  </tr>
  <tr> 
    <td valign="top" align="center"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="7">
        <tr> 
          <td valign="top"> 
            <p> 
              <?php include('/usr/home/single/www/1hiphop-pott.de/forum/login_index.php'); ?>
            </p>
          </td>
        </tr>
        <tr>
          <td valign="top">
            <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#999999">
              <tr>
                <td bgcolor="#CCCCCC">                
</td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
Anschließend habe ich eine zweite Datei versucht über "PHP-Include" einzufügen und zwar so:

Code: Alles auswählen

<table width="204" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td> 
      <div align="right"><img src="images/header/space.gif" width="205" height="10" alt="Space"><br>
        <img src="images/rightcontent/content/headlines/termin.gif" width="205" height="20" alt="_Termin!"></div>
    </td>
  </tr>
  <tr> 
    <td valign="top" align="center"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="7">
        <tr> 
          <td> 
            <p>&nbsp;</p>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td> 
      <div align="right"><img src="images/rightcontent/content/headlines/community.gif" width="205" height="20" alt="_Community"></div>
    </td>
  </tr>
  <tr> 
    <td valign="top" align="center"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="7">
        <tr> 
          <td valign="top"> 
            <p> 
              <?php include('/usr/home/single/www/1hiphop-pott.de/forum/login_index.php'); ?>
            </p>
          </td>
        </tr>
        <tr>
          <td valign="top">
            <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#999999">
              <tr>
                <td bgcolor="#CCCCCC">                
<?php include('/usr/home/single/www/1hiphop-pott.de/forum/online_index.php'); ?>
</td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
Sobald ich die zweite Datei eingefügt habe, kommt bei jedem Aufrufen meiner Seite, die Contenido-LogIn Seite und nichts anderes mehr. Sobald ich das zweite Include rausnehme, geht alles wieder ohne Probleme!

Meine Frage jetzt: Wie viele Dateien kann ich in einem Container "Includen" bzw. woran liegt mein Problem?

MfG
Christoph[/code]
timo
Beiträge: 6284
Registriert: Do 15. Mai 2003, 18:32
Wohnort: Da findet ihr mich nie!
Kontaktdaten:

Re: Icludes in Modul

Beitrag von timo »

KrissKrass hat geschrieben:Sobald ich die zweite Datei eingefügt habe, kommt bei jedem Aufrufen meiner Seite, die Contenido-LogIn Seite und nichts anderes mehr. Sobald ich das zweite Include rausnehme, geht alles wieder ohne Probleme!

Meine Frage jetzt: Wie viele Dateien kann ich in einem Container "Includen" bzw. woran liegt mein Problem?
[/code]
Contenido beschränkt nichts. Vermutlich ist in deiner zweiten Datei ein Programmierfehler - siehe errorlog.txt im Backend, oder stelle display_errors in der config.php auf true!
KrissKrass
Beiträge: 86
Registriert: Mi 2. Jun 2004, 16:01
Wohnort: Bochum
Kontaktdaten:

Beitrag von KrissKrass »

Hallo timo,

das komische ist nur in meiner Error Log-Datei befindet sich kein Eintrag der irgendwie mit dem 19.10. bzw. dem 20.10. zu tun hat, also genau mit dem Tag an dem der Fehler aufgetreten ist.
Auch finde ich sehr mysteriös, dass jetzt obwohl ich die Include-Datei rausgelassen habe immer noch das LogIn-Feld angezeigt wird, allerdings nur wenn man direkt auf der Seite surft im Adminbereich bei der Vorschau wird die Seite richtig angezeigt.

Diese Stelle mit dem Error in der Config-Datei gibt es bei mir nicht...

Und wiso ruft Contenido eigentlich immer direkt dieses komisch Login-Feld auf und kann nicht einfach nur eine Fehlermeldung ausgeben? Kann man dieses Login-Feld deaktivieren?

Kann es auch daran liegen, mit meinem Fehler meine ich, dass ich mir rewrite_rule arbeite?

MfG
Christoph

Die Datei die ich Include möchte, sieht so aus:

Code: Alles auswählen

<?php

$css ="http://www.hiphop-pott.de/css/style.css";
$length = '25';
$limit = '10';
$root ='/usr/home/single/www/1hiphop-pott.de/forum/';

define('IN_PHPBB', false);
$phpbb_root_path = '/usr/home/single/www/1hiphop-pott.de/forum/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

@$userdata = session_pagestart($user_ip, PAGE_INDEX);
@init_userprefs($userdata);

// #### html output ####
echo "<link rel=\"stylesheet\" href=\"$css\" type=\"text/css\">"; // - optional
echo "<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">";
// #### html output ####

$sql = "SELECT post_id FROM " . POSTS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
        message_die(GENERAL_ERROR, 'Could not obtain matched posts list', '', __LINE__, __FILE__, $sql);
}
$recent_ids = array();
while( $row = $db->sql_fetchrow($result) )
{
        $recent_ids[] = $row['post_id'];
}
$db->sql_freeresult($result);

$recent_forum = ( isset($HTTP_POST_VARS['forum']) ) ? intval($HTTP_POST_VARS['forum']) : -1;
if ( $recent_forum == -1 )
{
        $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
        $ignore_forum_sql = '';
        while( list($key, $value) = each($is_auth_ary) )
        {
                if ( !$value['auth_read'] )
                {
                        $ignore_forum_sql .= ( ( $ignore_forum_sql != '' ) ? ', ' : '' ) . $key;
                }
        }
        if ( $ignore_forum_sql != '' )
        {
                $auth_sql .= ( $auth_sql != '' ) ? " AND f.forum_id NOT IN ($ignore_forum_sql) " : "f.forum_id NOT IN ($ignore_forum_sql) ";
        }
}
                if ( $recent_author == '' && $auth_sql == '' )
                {
                        $sql = "SELECT topic_id FROM " . POSTS_TABLE . "
                                WHERE post_id IN (" . implode(", ", $recent_ids) . ")
                                $where_sql GROUP BY topic_id";
                }
                else
                {
                        $from_sql = POSTS_TABLE . " p";
                        if ( $auth_sql != '' )
                        {
                                $from_sql .= ", " . FORUMS_TABLE . " f";
                                $where_sql .= " AND f.forum_id = p.forum_id AND $auth_sql";
                        }
                        $sql = "SELECT p.topic_id FROM $from_sql
                                WHERE p.post_id IN (" . implode(", ", $recent_ids) . ")
                                $where_sql GROUP BY p.topic_id";
                }
                if ( !($result = $db->sql_query($sql)) )
                {
                        message_die(GENERAL_ERROR, 'Could not obtain topic ids', '', __LINE__, __FILE__, $sql);
                }

                $recent_ids = array();
                while( $row = $db->sql_fetchrow($result) )
                {
                        $recent_ids[] = $row['topic_id'];
                }
                $db->sql_freeresult($result);

$auth_results = implode(', ', $recent_ids);
$sql = "SELECT t.*, f.forum_id, f.forum_name, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
        FROM ". TOPICS_TABLE ." t, ". FORUMS_TABLE ." f, ". USERS_TABLE ." u, ". POSTS_TABLE ." p, ". POSTS_TABLE ." p2, ". USERS_TABLE ." u2
        WHERE t.topic_id IN ($auth_results)
              AND t.topic_poster = u.user_id
              AND f.forum_id = t.forum_id
              AND p.post_id = t.topic_first_post_id
              AND p2.post_id = t.topic_last_post_id
              AND u2.user_id = p2.poster_id
        ORDER BY t.topic_last_post_id DESC LIMIT $limit";
if ( !$result = $db->sql_query($sql) )
{
        message_die(GENERAL_ERROR, 'Could not obtain main information', '', __LINE__, __FILE__, $sql);
}
$line = array();
while( $row = $db->sql_fetchrow($result) )
{
        $line[] = $row;
}
$db->sql_freeresult($result);

        $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
        $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
        for($i = 0; $i < count($line); $i++)
        {
                $forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $line[$i]['forum_id']);
                $forum_id = $line[$i]['forum_id'];
                $topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $line[$i]['topic_id']);
                $topic_id = $line[$i]['topic_id'];

                $orig_word = array();
                $replacement_word = array();
                obtain_word_list($orig_word, $replacement_word);
                $word_censor = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $line[$i]['topic_title']) : $line[$i]['topic_title'];
                $topic_title = ( strlen($line[$i]['topic_title']) < $length ) ? $word_censor : substr(stripslashes($word_censor), 0, $length) . "...";

                $topic_type = ( $line[$i]['topic_type'] == POST_ANNOUNCE ) ? $lang['Topic_Announcement'] .' ': '';
                $topic_type .= ( $line[$i]['topic_type'] == POST_STICKY ) ? $lang['Topic_Sticky'] .' ': '';
                $topic_type .= ( $line[$i]['topic_vote'] ) ? $lang['Topic_Poll'] .' ': '';

                $views = $line[$i]['topic_views'];
                $replies = $line[$i]['topic_replies'];
                if ( ( $replies + 1 ) > $board_config['posts_per_page'] )
                {
                        $total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
                        $goto_page = ' [ ';
                        $times = 1;
                        for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
                        {
                                $goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '" >' . $times . '</a>';
                                if ( $times == 1 && $total_pages > 4 )
                                {
                                        $goto_page .= ' ... ';
                                        $times = $total_pages - 3;
                                        $j += ( $total_pages - 4 ) * $board_config['posts_per_page'];
                                }
                                else if ( $times < $total_pages )
                                {
                                        $goto_page .= ', ';
                                }
                                $times++;
                        }
                        $goto_page .= ' ] ';
                }
                else
                {
                        $goto_page = '';
                }

                if ( $line[$i]['topic_status'] == TOPIC_LOCKED )
                {
                        $folder = $images['folder_locked'];
                        $folder_new = $images['folder_locked_new'];
                }
                else if ( $line[$i]['topic_type'] == POST_ANNOUNCE )
                {
                        $folder = $images['folder_announce'];
                        $folder_new = $images['folder_announce_new'];
                }
                else if ( $line[$i]['topic_type'] == POST_STICKY )
                {
                        $folder = $images['folder_sticky'];
                        $folder_new = $images['folder_sticky_new'];
                }
                else
                {
                        if ( $replies >= $board_config['hot_threshold'] )
                        {
                                $folder = $images['folder_hot'];
                                $folder_new = $images['folder_hot_new'];
                        }
                        else
                        {
                                $folder = $images['folder'];
                                $folder_new = $images['folder_new'];
                        }
                }

                if ( $userdata['session_logged_in'] )
                {
                        if ( $line[$i]['post_time'] > $userdata['user_lastvisit'] )
                        {
                                if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
                                {
                                        $unread_topics = true;
                                        if ( !empty($tracking_topics[$topic_id]) )
                                        {
                                                if ( $tracking_topics[$topic_id] > $line[$i]['post_time'] )
                                                {
                                                        $unread_topics = false;
                                                }
                                        }
                                        if ( !empty($tracking_forums[$forum_id]) )
                                        {
                                                if ( $tracking_forums[$forum_id] > $line[$i]['post_time'] )
                                                {
                                                        $unread_topics = false;
                                        }
                                        }
                                        if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
                                        {
                                                if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $line[$i]['post_time'] )
                                                {
                                                        $unread_topics = false;
                                        }
                                        }
                                        if ( $unread_topics )
                                        {
                                                $folder_image = $folder_new;
                                        $folder_alt = $lang['New_posts'];
                                                $newest_img = '<a href="' . append_sid("http://www.1hiphop-pott.de/forum/viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="'. $root.'/'.$images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
                                        }
                                        else
                                        {
                                                $folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
                                                $folder_image = $folder;
                                        $folder_alt = $folder_alt;
                                        $newest_img = '';
                                        }
                                }
                                else if ( $line[$i]['post_time'] > $userdata['user_lastvisit'] )
                                {
                                        $folder_image = $folder_new;
                                        $folder_alt = $lang['New_posts'];
                                        $newest_img = '<a href="' . append_sid("http://www.1hiphop-pott.de/forum/viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="'. $root.'/'.$images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
                                }
                                else
                                {
                                        $folder_image = $folder;
                                        $folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
                                        $newest_img = '';
                                }
                        }
                        else
                        {
                                $folder_image = $folder;
                                $folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
                                $newest_img = '';
                        }
                }
                else
                {
                        $folder_image = $folder;
                        $folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
                        $newest_img = '';
                }

                $forum_name = $line[$i]['forum_name'];

                $first_time = create_date($board_config['default_dateformat'], $line[$i]['topic_time'], $board_config['board_timezone']);
                $first_author = ( $line[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("http://www.1hiphop-pott.de/forum/profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $line[$i]['user_id']) . '" class="genmed">'.$line[$i]['username'].'</a>' : ( ($line[$i]['post_username'] != '' ) ? $line[$i]['post_username'] : $lang['Guest'] );
                $last_time = create_date($board_config['default_dateformat'], $line[$i]['post_time'], $board_config['board_timezone']);
                $last_author = ( $line[$i]['id2'] == ANONYMOUS ) ? ( ($line[$i]['post_username2'] != '' ) ? $line[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("http://www.1hiphop-pott.de/forum/profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $line[$i]['user_id']) . '" class="genmed">' . $line[$i]['user2'] . '</a>';
                $last_url = '<a href='. append_sid("http://www.1hiphop-pott.de/forum/viewtopic.$phpEx?"  . POST_POST_URL . '=' . $line[$i]['topic_last_post_id']) . '#' . $line[$i]['topic_last_post_id'].'><img src='.$root.'/'.$images['icon_latest_reply'].' alt='.$lang['View_latest_post'].' border=\"0\" /></a>';
                $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

// #### html output ####
echo "<td class=\"$row_class\"><a href=\"http://www.1hiphop-pott.de/forum/$topic_url\" class=\"topictitle\">$topic_title</a></span>
         <font size=\"-6\">$goto_page<br />$lang[Started] $last_time $lang[by] $last_author</font><p></td></tr>";
// #### html output ####
        }

// #### html output ####
echo "</table>";
// #### html output ####
?>
timo
Beiträge: 6284
Registriert: Do 15. Mai 2003, 18:32
Wohnort: Da findet ihr mich nie!
Kontaktdaten:

Beitrag von timo »

vermutlich überschreibst du in deinem Include irgendwelche Contenido-Variablen...
KrissKrass
Beiträge: 86
Registriert: Mi 2. Jun 2004, 16:01
Wohnort: Bochum
Kontaktdaten:

Beitrag von KrissKrass »

Wie ich überschreibe irgendwelche Contenido-Variablen... Wie kann das denn sein und siehst du vielleicht welche Variablen das sein könnten?

Gibt es noch irgendeine andere Möglichkeit diese Datei zu includen in einen Container?
timo
Beiträge: 6284
Registriert: Do 15. Mai 2003, 18:32
Wohnort: Da findet ihr mich nie!
Kontaktdaten:

Beitrag von timo »

wenn du z.b. in deinem Script die Variable $client überschreibst, funktioniert Contenido nicht mehr.
KrissKrass
Beiträge: 86
Registriert: Mi 2. Jun 2004, 16:01
Wohnort: Bochum
Kontaktdaten:

Beitrag von KrissKrass »

Also, ich bin jetzt den kompletten Quellcode durchgegangen um mal zu gucken, ob es Variablen gibt, die Contenido auch benutzt.

Die einzige Variable die vielleicht mit Contenido in Verbindung gebracht werden könnte ist:

Code: Alles auswählen

$line
Alle anderen Variablen sind so in der Art:

Code: Alles auswählen

$user_id
$forum_id
$topic_id
u.s.w.
Also an denen wird es warscheinlich nicht liegen!
emergence
Beiträge: 10653
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence »

vielleicht liegts ja an der $lang variable...
*** make your own tools (wishlist :: thx)
kummer
Beiträge: 2423
Registriert: Do 6. Mai 2004, 09:17
Wohnort: Bern, Schweiz
Kontaktdaten:

Beitrag von kummer »

das einfachste ist immer, gleich eine klasse zu schreiben. innerhalb der klasse hast du automatisch einen neuen kontext. in der folge kann es gar nie dazu kommen, dass du irrtümlich globale variablen überschreibst.
aitsu.org :: schnell - flexibel - komfortabel :: Version 2.2.0 (since June 22, 2011) (jetzt mit dual license GPL/kommerziell)
KrissKrass
Beiträge: 86
Registriert: Mi 2. Jun 2004, 16:01
Wohnort: Bochum
Kontaktdaten:

Beitrag von KrissKrass »

Hallo,

also ich habe das jetzt geschafft, dass die Forum-Include-Datei ohne Fehler includet wird und auch die letzten Topics immer anzeigt!

Ansehen könnt ihr das unter:
http://www.hiphop-pott.de/index_28.html

Es geht um die rechte Seite, also das Login-Feld u.s.w.!

Danke für eure Hilfe!

MfG
Christoph[/b]
KrissKrass
Beiträge: 86
Registriert: Mi 2. Jun 2004, 16:01
Wohnort: Bochum
Kontaktdaten:

Beitrag von KrissKrass »

Also,

irgendwie funktioniert doch wieder gar nichts mehr...
Erst hat das Includen funktioniert und jetzt ist es wieder so, wenn ich das erstemal eine Seite aufrufe, wird alles richtig angezeigt sobald ich auf eine weitere Seite klicken möchte, öffnet sich das Contenido Login-Feld.

Wie kann ich eine klasse schreiben bzw. was ist eine klasse? Und kann ich danach dann alle Dateien ohne Probleme includen, ohne das Contenido direkt wieder spinnt?

Und ein neuer Fehler ist auch noch aufgetreten:
Für meinen Adserver muss ich drei Dateien includen, damit die Banner angezeigt werden können.
Diese drei Includes sollen noch vor den Quellcode der eigentlichen Seite, also habe ich die dre Zeilen in der front_content.php ganz an den Anfang gesetzt. Dann lässt sich wieder eine Seite aufrufen und bei der zweiten erscheint dieses Login-Feld.

Wenn ich die drei Include-Dateien in das Modul packe, in dem der Banner angezeigt werden soll, ist das Problem das gleiche... Eine Seite geht aufzurufen und bereits die zweite hat wieder dieses Login-Feld von Contenido.

Es handelt sich um folgende Include-Dateien:

Code: Alles auswählen

<?
 require("/usr/home/single/www/1hiphop-pott.de/adserver/config.inc.php3");
 require("/usr/home/single/www/1hiphop-pott.de/adserver/view.inc.php3");
 require("/usr/home/single/www/1hiphop-pott.de/adserver/acl.inc.php3");
?>
Ich arbeite mit dem Script phpAds, folgendes steht in der Documentation.html-Datei die bei dem Script dabei ist:

Code: Alles auswählen

This is the tradtional style of a including a banner within a PHP3-powered website. On every page you want to have a banner, you have to include config.inc.php3, view.inc.php3 and acl.inc.php3. These files are in your phpAds-installation-directory. Banner are displayed using the view()-function. This function has the following syntax: 

int view (mixed what [, int clientID [, string target [, bool withText = 0[, array context]]]]); 
The argument "what" is currently one of the following: 
[int]: Display the banner with this bannerID. Example: view(1); 
"[width]x[height]: Display a randomly selected banner with this width/height. Example: view("468x60"); 
"html": Display a randomly selected HTML-banner 
"[keyword]": Display a randomly selected banner with this keyword associated to it. Example: view("maingroup");
Note: Banners with the special keyword "global" associated to them, are also considered when using this syntax.

The optional argument clientID allows you to retrieve only banners by a specific client. Specify "" to view banners from all clients (in case you need the third or fourth argument, else don't specify it at all). 
Example: view("468x60", 1). 
The optional argument "target" allows you to specify a frame target (may be one of "[framename]", "_blank", "_parent" and "_top"). 
Example: view("maingroup", 0, "_blank"); 
The optional argument withText allows you to show a banner with its associated line of text below it (for example, "Suport our sponsor" is a common line of text). 
Example: view("maingroup", 0, "", 1); 
The optional argument "context" is an array specifying banners to limit the search to or/and banners to be excluded from the search. It is an array containing as many associative arrays as you want. The key of the entries must either be "==" to denote a banner to which the search is limited to or "!=" to denote a banner to be excluded from the search. The value of an entry is a banner ID. For example, to show the same randomly selected banner on the top and bottom of a page, you could use the following:

// Top of the page:
$id = view("main", 5); 
// Bottom of the page
$arr = array(
        array("==" => $id)
       );
view("main", 0, "", 0, $arr);
To make sure that the page does not the same banner two times, you could use this:
// Top of the page:
$id = view("main", 5); 

// Bottom of the page
$arr = array(
        array("!=" => $id)
       );
view("main", 0, "", 0, $arr); 


Some examples:

view(1); - Displays the banner with the bannerID of 1. 
view("html"); - Displays a randomly selected HTML banner 
view("468x60", 0, "_blank"); - Displays a randomly selected banner with a width of 468 pixels and a height of 60 pixels. If user clicks on it, the target destination will be opened in a new window. 
view("Websites/Business/New_Media/"); - Displays a randomly selected banner from the group "Websites/Business/New_Media/" (in other words: with that keyword). 
A sample HTML file could look like this:


<?
 require("/usr/local/etc/phpAds/config.inc.php3"); 
 require("/usr/local/etc/phpAds/view.inc.php3"); 
 require("/usr/local/etc/phpAds/acl.inc.php3"); 
?> 
  
<html>
    <head> 
      <title>phpAds demo</title>
    </head>
  <body>
    <?
      view("468x60");
    ?>
  </body>
</html> 
             
Remote Invocation
It is also possible to use phpAds on sites which lack PHP-support. Random or pre-defined banners can be shown using a standard <img>-construct. Just like in Local Mode, you can use the "what" argument to select the banner.


To use multiple banners on a single page, select a unique name for each banner and assign it to the "n" argument for both "click.php3" and "phpads.php3". 


Examples: 

<a href="click.php3"><img src="phpads.php3?what=468x60&n=ban1"></a> - Show a randomly selected banner of the size 468x60. 
<a href="click.php3?n=top"><img src="phpads.php3?what=main&n=top"></a> - Show a randomly selected banner from the "main" group with the name "top". 
<a href="click.php3?n=left"><img src="phpads.php3?what=468x60&n=left"></a> - Show a randomly selected banner of the size 468x60 with the name "left". 
Gesperrt