collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 254
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: How to make an Ad Block out of HTML Block  (Read 16379 times)

0 Members and 2 Guests are viewing this topic.

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
How to make an Ad Block out of HTML Block
« on: December 19, 2008, 06:45:23 AM »
hi everyone , after I had some problems with installing the Ad Management Mod with my custom Theme , I thought of making an ad Block from HTML block , the idea is simple just write '#ad' as a title and the block will turn into an ad block ,  its a normal block the only difference you won't see the frames like a block and also no title bar, it will display only the contents which could be a Banner , a google Ad Sense advertisment etc. here is the Code :
in SportalBlocks1-1.template.php find :
Code: [Select]
echo '
<div class="tborder">
<table class="bordercolor" width="100%">
<tr class="catbg">
<td style="padding: 5px;">';
if(empty($block['force_view']))
echo '
<a style="float:right;" href="javascript:void(0);" onclick="doCollapseObject(\'sp_block' . $block['id'], '\', \'', $settings['csect_cookie'], '\')"><img id="img_sp_block', $block['id'], '" src="', $settings['images_url'], $block['collapsed'] ? '/expand.gif' : '/collapse.gif', '" alt="*" border="0" /></a>';
echo '
', parse_bbc($block['label']), '
</td>
</tr>
<tr class="windowbg" ', (empty($block['force_view']) ? 'id="sp_block' . $block['id'] . '"' : '') , $block['collapsed'] ? ' style="display:none;"' : '', '>
<td style="padding: 5px;">';

if(in_array($block['type'], array('sp_bbc', 'sp_html', 'sp_php')))
{
$block['type']($block['content']);
}
else
{
$parameters = explode(',', $block['parameters']);
$block['type']($parameters);
}

echo '
</td>
</tr>
</table>
</div>

<br />';

Replace with :
Code: [Select]
////////////// AD BLOCK Check //////////////
$adblock=$block['label'];
if (substr($adblock,0,3)=='#ad'){
echo '<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr><td align="center">';
if(in_array($block['type'], array('sp_bbc', 'sp_html', 'sp_php')))
{
$block['type']($block['content']);
}
else
{
$parameters = explode(',', $block['parameters']);
$block['type']($parameters);
}

echo '
</td>
</tr>
</table>';
} else {

echo '
<div class="tborder">
<table class="bordercolor" width="100%">
<tr class="catbg">
<td style="padding: 5px;">';
if(empty($block['force_view']))
echo '
<a style="float:right;" href="javascript:void(0);" onclick="doCollapseObject(\'sp_block' . $block['id'], '\', \'', $settings['csect_cookie'], '\')"><img id="img_sp_block', $block['id'], '" src="', $settings['images_url'], $block['collapsed'] ? '/expand.gif' : '/collapse.gif', '" alt="*" border="0" /></a>';
echo '
', parse_bbc($block['label']), '
</td>
</tr>
<tr class="windowbg" ', (empty($block['force_view']) ? 'id="sp_block' . $block['id'] . '"' : '') , $block['collapsed'] ? ' style="display:none;"' : '', '>
<td style="padding: 5px;">';

if(in_array($block['type'], array('sp_bbc', 'sp_html', 'sp_php')))
{
$block['type']($block['content']);
}
else
{
$parameters = explode(',', $block['parameters']);
$block['type']($parameters);
}

echo '
</td>
</tr>
</table>
</div>

<br />';
}
////////////// END ///////////


« Last Edit: December 19, 2008, 07:11:10 PM by Nabil »

Offline jb3398

  • Semi Newbie
  • *
  • Posts: 29
Re: How to make an Ad Block out of HTML Block
« Reply #1 on: December 23, 2008, 05:34:12 PM »
Nice do you have an example of this mod in action, a url link.

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: How to make an Ad Block out of HTML Block
« Reply #2 on: December 23, 2008, 06:45:18 PM »
Quote
Nice do you have an example of this mod in action, a url link.
it is not a Mod , it is a change I have made on adding a html block function (a function found in Simple Portal) the change will hide/remove the borders and the title bar of a block letting only the inside of a block to be seen , like the following image .. you can see , that the ad is displayed as it is without a block surrounding it.
« Last Edit: December 24, 2008, 03:43:30 PM by Nabil »

Offline artificialive

  • Semi Newbie
  • *
  • Posts: 5
Re: How to make an Ad Block out of HTML Block
« Reply #3 on: February 06, 2009, 07:57:29 AM »
Hi there,
i found out that your modification is interesting and useful.
however, i have tried but it don't seem to be materialized.
anyone can help me to testify the mod i have done, pleasee?

attached is the SPortalBlocks1-1.template.php

thanks very much.

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: How to make an Ad Block out of HTML Block
« Reply #4 on: February 07, 2009, 02:49:49 AM »
I have tested your 'SPortalBlocks1-1.template' , it works
so what's the problem?
« Last Edit: February 07, 2009, 03:26:10 AM by Nabil »

Offline artificialive

  • Semi Newbie
  • *
  • Posts: 5
Re: How to make an Ad Block out of HTML Block
« Reply #5 on: February 09, 2009, 05:53:53 AM »
Im not sure why.
Well im a newbie on SMF.
Im using the overviewlight theme by dziner studio.
i cant find the SPortalBlocks1-1.template.php file anywhere except from the default theme directory.
Is there any other location of the SPortalBlocks1-1.template.php file that i should edit?

thanks a lot  :nervous-happy:

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: How to make an Ad Block out of HTML Block
« Reply #6 on: February 09, 2009, 10:20:39 AM »
Quote
Is there any other location of the SPortalBlocks1-1.template.php file that i should edit?

I have it in my Theme's Directory

Offline artificialive

  • Semi Newbie
  • *
  • Posts: 5
Re: How to make an Ad Block out of HTML Block
« Reply #7 on: February 09, 2009, 11:44:59 AM »
Hi Nabil,
thanks for trying to help me out. but i cant find the file in my Theme's directory.
Uploaded the file to my Theme's directory though, but it didnt work.
Anyway, u can see it here at my site. the ad has the header '#ad'.
http://ftmk.putrabytes.com


Offline Manu

  • Translator
  • *
  • Posts: 203
  • Gender: Female
  • Angel by Day, Devil by Night
    • Arsenie Official Forum
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: How to make an Ad Block out of HTML Block
« Reply #8 on: February 09, 2009, 11:48:14 AM »
Im not sure why.
Well im a newbie on SMF.
Im using the overviewlight theme by dziner studio.
i cant find the SPortalBlocks1-1.template.php file anywhere except from the default theme directory.
Is there any other location of the SPortalBlocks1-1.template.php file that i should edit?

thanks a lot  :nervous-happy:

I'm using the Overview Multicolor, and the my SPortalBlocks1-1.template.php is only in the folder of the default.

Hi Nabil,
thanks for trying to help me out. but i cant find the file in my Theme's directory.
Uploaded the file to my Theme's directory though, but it didnt work.
Anyway, u can see it here at my site. the ad has the header '#ad'.
http://ftmk.putrabytes.com



Could it be you have add '#ad' as title of the block instead of a name for the block? Don't know how to explain it in English.  :-[
Sometimes I'm an angel, sometimes I'm a devil, but I am always 100% woman and if you have a problem with me, learn to deal with it!

Offline artificialive

  • Semi Newbie
  • *
  • Posts: 5
Re: How to make an Ad Block out of HTML Block
« Reply #9 on: February 09, 2009, 01:12:08 PM »
Hi Manu,
Im not sure what do u mean, but im putting '#ad' as my block name.
Attached is the image on how i filled up the html block.

Is there anything wrong?

Offline Manu

  • Translator
  • *
  • Posts: 203
  • Gender: Female
  • Angel by Day, Devil by Night
    • Arsenie Official Forum
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: How to make an Ad Block out of HTML Block
« Reply #10 on: February 09, 2009, 04:32:45 PM »
Now I see I was wrong.
The '#ad' should remove all the borders of the block itself.  :-[
I think that's something for our Dev's, cause that's to much php for me.  :-[
Sorry, but here I can't help you.  :-[
Sometimes I'm an angel, sometimes I'm a devil, but I am always 100% woman and if you have a problem with me, learn to deal with it!

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: How to make an Ad Block out of HTML Block
« Reply #11 on: February 09, 2009, 05:13:15 PM »
it did not work in your case as I can see from the attached image because you didn't write at the beginning the '<?php' , the php block is not like a normal php site you should write that symbol , just write something like
<?php
///////////// ///////////////////
?>


at the begining of your code and it will go

by the way the name of the block is not only limited to #ad , you can give it #adname1 or #adname2 or #adname3   , any name after #ad

I can also see in the image that you have givin the name '#ad'
write #ad not '#ad'
« Last Edit: February 09, 2009, 05:37:01 PM by Nabil »

Offline artificialive

  • Semi Newbie
  • *
  • Posts: 5
Re: How to make an Ad Block out of HTML Block
« Reply #12 on: February 10, 2009, 09:36:50 AM »
Hello,
thanks for all the replies.  It really helped!
Now the ads are borderless  :D
Thank you, thank you.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: How to make an Ad Block out of HTML Block
« Reply #13 on: February 17, 2009, 06:49:26 AM »
Hi I tried this on a SPortalBlocks2.template but it didn't work. Here is the code:

Code: [Select]
$adblock=$block['label'];
if (substr($adblock,0,3)=='#ad'){
echo '<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr><td align="center">';
if(in_array($block['type'], array('sp_bbc', 'sp_html', 'sp_php')))
   {
      $block['type']($block['content']);
   }
   else
   {
      $parameters = explode(',', $block['parameters']);
      $block['type']($parameters);
   }

   echo '
                     </td>
                  </tr>
               </table>';
} else {
echo '
<div class="tborder">
<table class="bordercolor" width="100%">
<tr class="catbg">
<td style="padding: 5px;">';
if(empty($block['force_view']))
echo '
<a style="float: right;" href="javascript:void(0);" onclick="doCollapseObject(\'sp_block' . $block['id'], '\', \'', $settings['csect_cookie'], '\')"><img id="img_sp_block', $block['id'], '" src="', $settings['images_url'], $block['collapsed'] ? '/expand.gif' : '/collapse.gif', '" alt="*" border="0" /></a>';
echo '
', parse_bbc($block['label']), '
</td>
</tr>
<tr class="windowbg" ', (empty($block['force_view']) ? 'id="sp_block' . $block['id'] . '"' : '') , $block['collapsed'] ? ' style="display:none;"' : '', '>
<td style="padding: 5px;">';

if(in_array($block['type'], array('sp_bbc', 'sp_html', 'sp_php')))
{
$block['type']($block['content']);
}
else
{
$parameters = explode(',', $block['parameters']);
$block['type']($parameters);
}

echo '
</td>
</tr>
</table>
</div>

<br />';
}

Can someone help me? ;D
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: How to make an Ad Block out of HTML Block
« Reply #14 on: February 26, 2009, 09:41:07 AM »
anyone? :'(
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: How to make an Ad Block out of HTML Block
« Reply #15 on: February 26, 2009, 01:13:43 PM »
That Code is made for sp with smf 1.x.x  , so it has to be modified to work with smf2 , but I did a simple test  with sp & smf2 , replaced SportalBlocks1-1.template.php instead of  SportalBlocks2.template.php by renaming it to  SportalBlocks2.template.php , I didn't see any change actually , so you can apply the code for SportalBlocks1-1.template.php and use it instead of  SportalBlocks2.template.php , but keep a backup copy of the Original SportalBlocks2.template.php , do this at your own risk I didnt test all the Blocks , just php and html
« Last Edit: February 26, 2009, 03:21:13 PM by Nabil »

Offline Contra

  • Semi Newbie
  • *
  • Posts: 24
  • Gender: Male
    • offroadjunkies
Re: How to make an Ad Block out of HTML Block
« Reply #16 on: February 27, 2009, 07:21:59 PM »
worked perfect for me!

Offline fl4pj4ck

  • Semi Newbie
  • *
  • Posts: 26
  • I pity the fools!
    • Poles in Limerick
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: How to make an Ad Block out of HTML Block
« Reply #17 on: February 27, 2009, 09:52:59 PM »
1) I have edited the file SPortalBlocks1
2) I have created a block for google adsense ads, the block type is set to "HTML"
3) I put the google ads code within the blocks
4) I have named the block #adFirst

what I'm doing wrong?

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: How to make an Ad Block out of HTML Block
« Reply #18 on: March 01, 2009, 11:36:51 AM »
Quote
I have edited the file SPortalBlocks1

you mean SPortalBlocks1-1.template.php dont you?

this is how a google code inside a HTML block looks like

Code: [Select]
<script type="text/javascript"><!--
google_ad_client = "pub-6566546455656
/* 728x90, text only */
google_ad_slot = "zttzztzt";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pgad.goolesyztztndcaion.com/pagea/show_ads.js">
</script><br>

Offline fl4pj4ck

  • Semi Newbie
  • *
  • Posts: 26
  • I pity the fools!
    • Poles in Limerick
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: How to make an Ad Block out of HTML Block
« Reply #19 on: March 01, 2009, 03:37:37 PM »
yes, that's what I meant

this block wont show either using #ad or the regular block, I'm just getting empty space, like it's not being recognized

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: How to make an Ad Block out of HTML Block
« Reply #20 on: March 02, 2009, 03:48:07 AM »
Can I see your SPortalBlocks1-1.template.php  ?

Offline fl4pj4ck

  • Semi Newbie
  • *
  • Posts: 26
  • I pity the fools!
    • Poles in Limerick
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: How to make an Ad Block out of HTML Block
« Reply #21 on: March 02, 2009, 07:28:09 AM »
Can I see your SPortalBlocks1-1.template.php  ?

Quote
<?php
/*

File: SPortalBlocks1-1.template.php
Version: SimplePortal 2.1.1 for SMF 1.x

*/

function template_portal_above()
{
   global $context, $modSettings;

   sp_collapse_script();

   echo '
   <table cellpadding="5px" width="100%">
      <tr>';
   
   if(!empty($modSettings['showleft']) && !empty($context['SPortal']['blocks']['Left']))
   {
      echo '
         <td valign="top"', !empty($modSettings['leftwidth']) ? ' width="' . $modSettings['leftwidth'] . '"' : '', '>';
      
      foreach ($context['SPortal']['blocks']['Left'] as $block)
         template_block($block);

      echo '
         </td>';
   }

   echo '
         <td valign="top">';

   foreach ($context['SPortal']['blocks']['Middle-Top'] as $block)
      template_block($block);
}

function template_portal_below()
{
   global $context, $modSettings;

   echo '
            <br />';
   
   foreach ($context['SPortal']['blocks']['Middle-Bottom'] as $block)
      template_block($block);

   echo '
         </td>';

   if(!empty($modSettings['showright']) && !empty($context['SPortal']['blocks']['Right']))
   {
      echo '
         <td valign="top"', !empty($modSettings['rightwidth']) ? ' width="' . $modSettings['rightwidth'] . '"' : '', '>';

      foreach ($context['SPortal']['blocks']['Right'] as $block)
         template_block($block);

      echo '
         </td>';
   }
   echo '
      </tr>
   </table>';
}

function template_block($block)
{
   global $settings;

   if(empty($block['force_view']))
      $block['collapsed'] = sp_collapse_state('sp_block' . $block['id']);
   else
      $block['collapsed'] = false;

   if ($block['type'] == 'sp_boardNews')
   {
      $parameters = explode(',', $block['parameters']);
      $block['type']($parameters);

      echo '
            <br />';

      return;
   }

/*
   echo '
            <div class="tborder">
               <table class="bordercolor" width="100%">
                  <tr class="catbg">
                     <td style="padding: 5px;">';
   if(empty($block['force_view']))
      echo '
                        <a style="float:right;" href="javascript:void(0);" onclick="doCollapseObject(\'sp_block' . $block['id'], '\', \'', $settings['csect_cookie'], '\')"><img id="img_sp_block', $block['id'], '" src="', $settings['images_url'], $block['collapsed'] ? '/expand.gif' : '/collapse.gif', '" alt="*" border="0" /></a>';
   echo '
                        ', parse_bbc($block['label']), '
                     </td>
                  </tr>
                  <tr class="windowbg" ', (empty($block['force_view']) ? 'id="sp_block' . $block['id'] . '"' : '') , $block['collapsed'] ? ' style="display:none;"' : '', '>
                     <td style="padding: 5px;">';

   if(in_array($block['type'], array('sp_bbc', 'sp_html', 'sp_php')))
   {
      $block['type']($block['content']);
   }
   else
   {
      $parameters = explode(',', $block['parameters']);
      $block['type']($parameters);
   }

   echo '
                     </td>
                  </tr>
               </table>
            </div>

            <br />';
*/

////////////// AD BLOCK Check //////////////
$adblock=$block['label'];
if (substr($adblock,0,3)=='#ad'){
echo '<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr><td align="center">';
if(in_array($block['type'], array('sp_bbc', 'sp_html', 'sp_php')))
   {
      $block['type']($block['content']);
   }
   else
   {
      $parameters = explode(',', $block['parameters']);
      $block['type']($parameters);
   }

   echo '
                     </td>
                  </tr>
               </table>';
} else {

   echo '
            <div class="tborder">
               <table class="bordercolor" width="100%">
                  <tr class="catbg">
                     <td style="padding: 5px;">';
   if(empty($block['force_view']))
      echo '
                        <a style="float:right;" href="javascript:void(0);" onclick="doCollapseObject(\'sp_block' . $block['id'], '\', \'', $settings['csect_cookie'], '\')"><img id="img_sp_block', $block['id'], '" src="', $settings['images_url'], $block['collapsed'] ? '/expand.gif' : '/collapse.gif', '" alt="*" border="0" /></a>';
   echo '
                        ', parse_bbc($block['label']), '
                     </td>
                  </tr>
                  <tr class="windowbg" ', (empty($block['force_view']) ? 'id="sp_block' . $block['id'] . '"' : '') , $block['collapsed'] ? ' style="display:none;"' : '', '>
                     <td style="padding: 5px;">';

   if(in_array($block['type'], array('sp_bbc', 'sp_html', 'sp_php')))
   {
      $block['type']($block['content']);
   }
   else
   {
      $parameters = explode(',', $block['parameters']);
      $block['type']($parameters);
   }

   echo '
                     </td>
                  </tr>
               </table>
            </div>

            <br />';
}
            ////////////// END ///////////

}

function sp_collapse_state($block_id)
{
   global $settings;

   if(isset($settings['collapsed_sects']) && !empty($settings['collapsed_sects']))
   {
      if(array_search($block_id, $settings['collapsed_sects']) === false)
         return false;
      else
         return true;
   }

   return false;
}

function sp_collapse_script()
{
   global $settings, $context;

   $csect_cookie = 'SMF_user_' . $context['user']['id'] . '_CSect';

   if(isset($_COOKIE[$csect_cookie]) && !empty($_COOKIE[$csect_cookie]))
       $settings['collapsed_sects'] = explode("\n", $_COOKIE[$csect_cookie]);
   $settings['csect_cookie'] = $csect_cookie;

   echo'
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[

var dom_engine = \'\';
if (document.getElementById)
   dom_engine = 1;               // mozilla, opera etc..
else if (document.all)
   dom_engine = 0;               // IE (pls die, kthx)
else if (document.layers)
   dom_engine = 2;               // NS4, should never happen :P

var active_menu = "";
var mouse_over_menu = "";

function getObject(id)
{
   if(dom_engine == 1)
      obj = document.getElementById(id);
   else if(dom_engine == 0)
      obj = document.all[id];
   else if(dom_engine == 2)
      obj = document.layers[id];
      
   return obj;
}

function getCookieFromDocument(cookie_name)
{
   cname = cookie_name + "=";
   clength = document.cookie.length;
   begin = 0;
   
   while (begin < clength) {
       vbegin = begin + cname.length;
       if (document.cookie.substring(begin, vbegin) == cname) {
      var end = document.cookie.indexOf (";", vbegin);
      if (end == -1) {
          end = clength;
      }
      return unescape(document.cookie.substring(vbegin, end));
       }
       begin = document.cookie.indexOf(" ", begin) + 1;
       if (begin == 0)   {
      break;
       }
   }
   return null;
}

function setCookieToDocument(cookie_name, cookie_expiredate, cookie_value)
{
    document.cookie=cookie_name+"="+escape(cookie_value)+"; expires="+cookie_expiredate.toGMTString()+"; path=/";
}

function saveObjectToCookie(obj, mode, cookiename)
{
   var already_collapsed=getCookieFromDocument(cookiename);
   var temp = new Array();
   cookieExpireDate = new Date();
   cookieExpireDate.setTime(cookieExpireDate.getTime() + 86400*1000*300);         // 300 days expiration date

   if (already_collapsed) {
       already_collapsed = already_collapsed.split("\n");

       for (i in already_collapsed) {
      if (already_collapsed != obj && already_collapsed != "")
          temp[temp.length] = already_collapsed;
       }
   }

   if (mode)
       temp[temp.length] = obj;

   setCookieToDocument(cookiename, cookieExpireDate, temp.join("\n"));
}

function doCollapseObject(id, cookiename)
{
   obj = getObject(id);   
   imageid = getObject("img_" + id);
   tempobj = getObject(id);
         
   if (obj.style.display == "none") {   // object is collapsed, show it, clear the cookie
       obj.style.display = "";
       saveObjectToCookie(id, 0, cookiename);
       if (imageid) {
      imageid.src = imageid.src.replace(\'expand.gif\', \'collapse.gif\');
       }
   } else {            // hide the object, save it to the cookie
       obj.style.display = "none";
       saveObjectToCookie(id, 1, cookiename);
       if (imageid) {
      imageid.src = imageid.src.replace(\'collapse.gif\', \'expand.gif\');
       }
   }
   return false;
}
   // ]]></script>';
}

?>

there it is, thanks a lot

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: How to make an Ad Block out of HTML Block
« Reply #22 on: March 02, 2009, 08:25:39 AM »
your SPortalBlocks1-1.template.php file works as expected , do you have it in your Custom Theme Directory?

Offline fl4pj4ck

  • Semi Newbie
  • *
  • Posts: 26
  • I pity the fools!
    • Poles in Limerick
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: How to make an Ad Block out of HTML Block
« Reply #23 on: March 02, 2009, 09:30:15 AM »
your SPortalBlocks1-1.template.php file works as expected , do you have it in your Custom Theme Directory?

no, I have it in /Themes/default
but now checked with all 3 files in /Themes/kelo and still "no go" :(

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: How to make an Ad Block out of HTML Block
« Reply #24 on: March 02, 2009, 11:14:19 AM »
I have tested your file with another Theme , where the  SPortalBlocks1-1.template.php  in the default Theme , it works also 100% as expected with no problem at all, I beleive it has nothing to do with the SPortalBlocks1-1.template.php , see if the Code you are using in the Block if it really displays something or not , test it with a normal block

Offline fl4pj4ck

  • Semi Newbie
  • *
  • Posts: 26
  • I pity the fools!
    • Poles in Limerick
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: How to make an Ad Block out of HTML Block
« Reply #25 on: March 02, 2009, 03:58:56 PM »
have a look at the bottom here: http://polacywlimerick.com/forum/index.php
here's my code:
Quote
<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxxx";
google_ad_slot = "xxxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pgad.goolesyztztndcaion.com/pagea/show_ads.js">
</script><br>

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: How to make an Ad Block out of HTML Block
« Reply #26 on: March 03, 2009, 05:12:15 AM »
the Google Code seems like a usual Code , nothing unusual , but
it doesn't show anything
Quote
this block wont show either using #ad or the regular block, I'm just getting empty space
and since this is the case also with a normal Block , then we can
say with 100% its a google script problem