Welcome to Geeklog, Anonymous Friday, November 29 2024 @ 12:34 pm EST

Geeklog Forums

Custom Block in article page


CosmicInsight

Anonymous
caffeinated
Hi... I'm new at this so please bear with me. What I did was I removed the "what's related" block from the article page and created a custom block based on how the story options block was created. It works, but because I used the COM_makeList() fuction it shows a little bullet on the left side. Is there another function I can use so that it doesn't show the bullet?

Thanks!
 Quote

ironmax

Anonymous
You are most likely looking for something like this, and just replace the href links with your own inside the normal block setting.





Spam

Hacking

Reporting network
abuse


RIR Networks

Our Spam Control Policy

Mail
Blocks






Text Formatted Code
<div align="left">
  <table border="0" cellpadding="0" cellspacing="0" width="200">
    <tr>
      <td><a href="/staticpages/index.php?page=20040801005027880">Spam</a>
  <br><a href="/staticpages/index.php?page=20040801015311973">Hacking</a>
  <br><a href="/staticpages/index.php?page=20040801013954950">Reporting network
    abuse</a>
  <br><a href="/staticpages/index.php?page=20040801031624549">RIR Networks</a>
        <br><a href="http://www.spacequad.com/staticpages/index.php?page=20040810012647519">Our Spam Control Policy</a>
        <br><a href="http://www.spacequad.com/staticpages/index.php?page=20040810013405532">Mail
        Blocks</a>
      </td>
    </tr>
  </table>
</div>
 
 Quote

cosmicInsight

Anonymous
no that's not really what I'm looking for...

ok... when you click on the "read more" link to see the full article, the right blocks are missing except for a "what's related" block and "story options" block. What I did was remove the what's related block and added a custom block in it's place. So I edited the article.php and article.thtml files and created my block based on how the "story options" block was created in article.php. It worked but there's a little bullet on left side of the block because I believe the COM_makeList() fuction put's it there. I wanna know how to remove that bullet.

Anyone else got any solutions?

Thanks!
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by cosmicInsight: So I edited the article.php and article.thtml files and created my block based on how the "story options" block was created in article.php.

Sounds like the problem is in your code then ...

bye, Dirk
 Quote

cosmicInsight

Anonymous
Quote by Dirk:
Quote by cosmicInsight: So I edited the article.php and article.thtml files and created my block based on how the &quot;story options&quot; block was created in article.php.

Sounds like the problem is in your code then ...

bye, Dirk


Ok here's my code in article.php....

//adsense related code ... making array and then putting code in array.
// probably a better way to do this....

$adsense_code = array ();
$adsense_code[] = '&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;pub-9403829711976375&quot;;
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = &quot;160x600_as&quot;;
google_ad_channel =&quot;&quot;;
google_color_border = &quot;2D5893&quot;;
google_color_bg = &quot;99AACC&quot;;
google_color_link = &quot;000000&quot;;
google_color_url = &quot;000099&quot;;
google_color_text = &quot;003366&quot;;
//--&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;&lt;/script&gt;';

// related adsense code... makes the block
if (count ($story_options) &gt; 0) {
$adsenseblock = COM_startBlock ($Lang11[5], '',
COM_getBlockTemplate('story_options_block', 'header'Wink)
. COM_makeList ($adsense_code)
. COM_endBlock (COM_getBlockTemplate ('story_options_block',
'footer'Wink);
}

$story_template-&gt;set_var ('adsense', $adsenseblock);


and then I just call {adsense} in article.thtml
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Why are you even using COM_makeList? As the name suggests, this function creates a list, using the list.thtml and listitem.thtml template files.

Simply remove that function call ...

bye, Dirk
 Quote

cosmicInsight

Anonymous
Quote by Dirk: Why are you even using COM_makeList? As the name suggests, this function creates a list, using the list.thtml and listitem.thtml template files.

Simply remove that function call ...

bye, Dirk


Ok I figured it out... thanks Dirk.
 Quote

Goat

Anonymous
Hi,

I too wanted to add an Adsense block to my site (www.worldfootynews.com). I successfully added it to my front page by adding a right block (advertisements) and just pasting in the html supplied by Google. But I also want it to appear on articles. I was following the technique listed here (is it the best way?) and it seemed to make sense (given I know bugger-all about php etc), but my stories just come up with a block title bar and the word "array" but no ads or anything. Any thoughts? It seems to be taking $adsense_code literally as the string array, even though I define it as suggested and fill it.

I followed as above, even cutting and pasting, except of course using my Google ad text and removing the COM_makelist call. So the 2 modified files are article.php and in article.thtml in the default theme apv_aeon I just added {adsense}.

When removing COM_makelist, what should I replace it with? I tried nothing and got nothing. I tried . $adsense_code and just got the word array. I think I'm close.

Or would it be better to use this thread:

http://www.geeklog.net/forum/viewtopic.php?forum=3&showtopic=38358

because surely I can just call advertsiments from article.php and get the block that works on the front page? I'd try this method but I'm halfway though method 1 and don't want to stuff it up, and I reckon I'm a bit light on on info to do this 2nd method anyway.

Help!?
 Quote

Goat

Anonymous

Can anyone help me? I suspect I'm only a line away from success but have no idea what that line is.

Banging your head
 Quote

Goat

Anonymous

OK, I'll stop bugging people after this last cry for help.... Dirk, somebody, anybody?

Can someone help me
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
Quote by cosmicInsight: I wanna know how to remove that bullet.
re the bullet issue. try this
 Quote

Goat

Anonymous
Thanks machinari! So sounds like you are recommending I stick to using makelist and just get rid of the bullets and indents as per that other thread. OK, I've tried that and it works, my ads (javascript) appear, although it has the drawback that I'm only up to GL 3.9 not 3.10 so I don't think I can set it just for a given class (wouldn't know how to anyway) so all my lists lose their bullets, which probably isn't great. If no other suggestions are forthcoming I might just have to live with a bullet next to my ads - still an improvement.

For interest, my code before switching to using makelist was (except I've blocked out my client id):

article.php:

$adsense_code = array ();
$adsense_code[] = '&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;pub-****************&quot;;
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = &quot;160x600_as&quot;;
google_ad_channel =&quot;&quot;;
google_color_border = &quot;666666&quot;;
google_color_bg = &quot;FFFFFF&quot;;
google_color_link = &quot;0000FF&quot;;
google_color_url = &quot;008000&quot;;
google_color_text = &quot;000000&quot;;
//--&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;
&lt;/script&gt;';


// related adsense code... makes the block
{
$adsenseblock = COM_startBlock ($LANG11[5], '',
COM_getBlockTemplate('story_options_block', 'header'Wink)
// . COM_makelist ($adsense_code)
. $adsense_code
. COM_endBlock (COM_getBlockTemplate ('story_options_block',
'footer'Wink);
}


$story_template-&gt;set_var ('whats_related', $related);
$story_template-&gt;set_var ('story_options', $optionsblock);
$story_template-&gt;set_var ('whats_related_story_options',
$related . $optionsblock);
$story_template-&gt;set_var ('adsense', $adsenseblock);

and in article.thtml call it with:

{whats_related_story_options}{adsense}


and instead of ads I just got the word &quot;Array&quot;. It would seem from reading at www.php.net and www.w3schools.com that I'm creating the array $adsense_code correctly, but my $adsenseblock isn't translating the javascript. Maybe I need to use echo to create the javascript? I'm way out of my depth. I've spent many hours trying to read up on the area, but can't really afford any more time as well as trying to maintain the website and write articles for it (all as a &quot;hobby&quotWink.
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
I know squat about javascript so cant help you there. and I am not suggesting you use or do not use makelist. just letting you know what I do in some cases. hope this helps.

Quote by Goat:I'm only up to GL 3.9 not 3.10 so I don't think I can set it just for a given class (wouldn't know how to anyway) so all my lists lose their bullets, which probably isn't great.

1.3.9 list.thtml looks like this:
Text Formatted Code
<!-- <ul> -->
{list_items}
<!-- </ul> -->

 
change it to this:
Text Formatted Code
<ul class="nobuttons">
{list_items}
</ul>

 
now use the CSS
Text Formatted Code
UL.nobuttons {
    list-style-position: inside;
    }
UL.nobuttons LI {
    list-style: none;
    }
 
or something along those lines...
 Quote

Goat

Anonymous

Thanks for the help. I implemented some of it, but I reckon I'll leave the rest until after we've upgraded to the latest version of GL (which will be ASAP).

Cheers!
 Quote

Status: offline

MrHyde

Forum User
Junior
Registered: 11/09/03
Posts: 15
I've tried the code above posted by Goat and it works ok, except for two things.
- the bullet point before the ads. I can live with that.
- The title of the block being "PDF Story Format". How/where do I change that to something else?

 Quote

All times are EST. The time is now 12:34 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content