Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Adding content to pages only  (Read 1808 times)


  • Newbie
  • *
  • Karma: 4
  • Posts: 40
Adding content to pages only
« on: December 18, 2007, 05:41:07 am »


digged a fiew hours now in the forums but didn't found any hint for me .. so here's my question ;)

How could i add content (like advertisments) into articles BUT the content should be only shown if a single page is watched by a visitor?


articles on frontpage or in category = no additional content block
direct call of an article = additional content block

Any help would be nice!



  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
Re: Adding content to pages only
« Reply #1 on: December 18, 2007, 04:28:29 pm »

There a few ways to do it, each depending on what form the other content is in.
If the advertisement is an image, then you could insert the image file-path into your page content and it would display.
If the advertisement is being generated with a block of html script, you could paste that script into your page content and it would display.
If it is a combination of html and javascript that won't work when pasting it into page content... then you could create a PHP function in a "customfunctions.php" file... include the new file at the top of your index.php file (under the include for snews.php) and then insert the function-name into your page content (where you want it displaying) using Philmoz's Function Insert mod.
Do it now... later may not come.
sNews 1.6 MESU | sNews 1.6 MEMU


  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Re: Adding content to pages only
« Reply #2 on: December 19, 2007, 10:08:19 am »

@amak : Including this additional function You can use following code snippet:
Code: [Select]
if ( 
$curItem['itemType'] == 'article' ) {
// This code block will be executed only for full article display

Depending on what You want to achieve either include it in index.php or make it a separate file (like page_only_extra.php) and use it inside articles text with default [include] tags like this: [include]page_only_extra.php[/include].