Welcome to Geeklog, Anonymous Sunday, September 01 2024 @ 12:46 am EDT
Geeklog Forums
Custom Block in article page
CosmicInsight
Anonymous
![caffeinated caffeinated](https://www.geeklog.net/forum/image_set/moods/caffeinated.gif)
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!
Thanks!
![](http://www.geeklog.net/images/smiles/pray.gif)
13
10
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
<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>
Spam
Hacking
Reporting network
abuse
RIR Networks
Our Spam Control Policy
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>
9
11
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!
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!
![](http://www.geeklog.net/images/smiles/help.gif)
9
8
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
10
10
Quote
cosmicInsight
Anonymous
Quote by Dirk:
Sounds like the problem is in your code then ...
bye, Dirk
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
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[] = '<script type="text/javascript"><!--
google_ad_client = "pub-9403829711976375";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_channel ="";
google_color_border = "2D5893";
google_color_bg = "99AACC";
google_color_link = "000000";
google_color_url = "000099";
google_color_text = "003366";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
// related adsense code... makes the block
if (count ($story_options) > 0) {
$adsenseblock = COM_startBlock ($Lang11[5], '',
COM_getBlockTemplate('story_options_block', 'header'
![Wink Wink](https://www.geeklog.net/forum/image_set/pixel.gif)
. COM_makeList ($adsense_code)
. COM_endBlock (COM_getBlockTemplate ('story_options_block',
'footer'
![Wink Wink](https://www.geeklog.net/forum/image_set/pixel.gif)
}
$story_template->set_var ('adsense', $adsenseblock);
and then I just call {adsense} in article.thtml
8
12
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
Simply remove that function call ...
bye, Dirk
8
10
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
Simply remove that function call ...
bye, Dirk
Ok I figured it out... thanks Dirk.
12
10
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!?
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!?
9
7
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 Banging your head](http://www.geeklog.net/images/smiles/banghead.gif)
10
10
Quote
Goat
Anonymous
OK, I'll stop bugging people after this last cry for help.... Dirk, somebody, anybody?
![Can someone help me Can someone help me](http://www.geeklog.net/images/smiles/help.gif)
9
7
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[] = '<script type="text/javascript"><!--
google_ad_client = "pub-****************";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_channel ="";
google_color_border = "666666";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>';
// related adsense code... makes the block
{
$adsenseblock = COM_startBlock ($LANG11[5], '',
COM_getBlockTemplate('story_options_block', 'header'
)
// . COM_makelist ($adsense_code)
. $adsense_code
. COM_endBlock (COM_getBlockTemplate ('story_options_block',
'footer'
);
}
$story_template->set_var ('whats_related', $related);
$story_template->set_var ('story_options', $optionsblock);
$story_template->set_var ('whats_related_story_options',
$related . $optionsblock);
$story_template->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 "Array". 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 "hobby"
.
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[] = '<script type="text/javascript"><!--
google_ad_client = "pub-****************";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_channel ="";
google_color_border = "666666";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>';
// related adsense code... makes the block
{
$adsenseblock = COM_startBlock ($LANG11[5], '',
COM_getBlockTemplate('story_options_block', 'header'
![Wink Wink](https://www.geeklog.net/forum/image_set/pixel.gif)
// . COM_makelist ($adsense_code)
. $adsense_code
. COM_endBlock (COM_getBlockTemplate ('story_options_block',
'footer'
![Wink Wink](https://www.geeklog.net/forum/image_set/pixel.gif)
}
$story_template->set_var ('whats_related', $related);
$story_template->set_var ('story_options', $optionsblock);
$story_template->set_var ('whats_related_story_options',
$related . $optionsblock);
$story_template->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 "Array". 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 "hobby"
![Wink Wink](https://www.geeklog.net/forum/image_set/pixel.gif)
10
7
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.
1.3.9 list.thtml looks like this:
{list_items}
<!-- </ul> -->
change it to this:
{list_items}
</ul>
now use the CSS
list-style-position: inside;
}
UL.nobuttons LI {
list-style: none;
}
or something along those lines...
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> -->
Text Formatted Code
<ul class="nobuttons">{list_items}
</ul>
Text Formatted Code
UL.nobuttons {list-style-position: inside;
}
UL.nobuttons LI {
list-style: none;
}
11
7
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!
11
11
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?
- 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?
8
5
Quote
All times are EDT. The time is now 12:46 am.
- 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