Witam. Chcę w pewnym znanym CMS'ie wyświetlać reklamy między postami.
Mam taką modyfikację:
<?php
/*
Key = Position of the Ad
Value = The AdSense Banner Code
*/
$advertisements = array('3' => '<!-- adsense ad code 1 here -->', '6' => '<!-- adsense ad code 2 here -->',
'9' => '<!-- adsense ad code 3 here -->');
$i = 1;
while (have_posts()) : the_post();
?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments ť', '1 Comment ť', '% Comments ť'); ?></p>
</div>
<?php
// you can add custom HTML code here
echo $advertisements[$i]; }
$i++;
endwhile;
?>
Wyświetla się wszystko w porządku. Natomiast problemem jest, jeżeli chcę zaincludować plik z daną reklamą.
Czyli chodzi o to:
$advertisements = array('3' => '<!-- adsense ad code 1 here -->', '6' => '<!-- adsense ad code 2 here -->',
'9' => '<!-- adsense ad code 3 here -->');
W jaki sposób mogę w miejscu np.
'<!-- adsense ad code 1 here -->', includować jakiś plik?
Czy może będzie jakieś inne rozwiązanie zastępujące array?