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: 264
  • 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]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

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

0 Members and 1 Guest are viewing this topic.

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