Joomla: adsense in content.php file

Discussion in 'Joomla' started by Canadianbacon, Sep 11, 2006.

  1. #1
    I want to have an adsense block appear at the top of everty content page, but i'm not sure where (how) to put it into the content.php file

    any help would be great

    if possible, i want to to sick it above the voting code...

    $params->def( 'pageclass_sfx', '' );
    $params->def( 'item_title', 1 );
    $params->def( 'url', 1 );

    // if a popup item (e.g. print page) set popup param to correct value
    if ( $pop ) {
    $params->set( 'popup', 1 );
    }

    // check if voting/rating enabled
    if ( $params->get( 'rating' ) ) {
    // voting query
    $query = "SELECT ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count"
    . "\n FROM #__content AS a"
    . "\n LEFT JOIN #__content_rating AS v ON a.id = v.content_id"
    . "\n WHERE a.id = $row->id"
    ;
    $database->setQuery( $query );
    $database->loadObject($voting);

    // add to $row info
    $row->rating = $voting->rating;
    $row->rating_count = $voting->rating_count;
    }

    if ( $params->get( 'section_link' ) || $params->get( 'category_link' ) ) {
    // loads the link for Section name
    if ( $params->get( 'section_link' ) || $params->get( 'category_link' ) ) {
    // pull values from mainframe
    $secLinkID = $mainframe->get( 'secID_'. $row->sectionid, -1 );
    $secLinkURL = $mainframe->get( 'secURL_'. $row->sectionid );
     
    Canadianbacon, Sep 11, 2006 IP
  2. bigmack

    bigmack Well-Known Member

    Messages:
    175
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #2
    Hey, easiest way to make it appear on every page is to edit your templates index file. You can slap anything you want in there and it'll show up on every page.(goto: Site>Template Manager>Site Templates and choose your template then "Edit HTML")

    Now be careful with that.. your adsense will show up on 404 and login/out etc. pages.

    Another way to do this (this is what I do)and select only the content pages is to create a new module and put your adsense code in the "Custom Output" box. Then Choose on the right what pages to put it on.(hold in CTRL and click to select individual pages)

    Hope that helps you out
     
    bigmack, Sep 11, 2006 IP
  3. nikg

    nikg Well-Known Member

    Messages:
    642
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    120
    #3
    There is no need to edit any files. You can use Joomlaspan adsense module. Install it, type your google id and then publish the module in any position you like.
     
    nikg, Sep 11, 2006 IP
  4. Canadianbacon

    Canadianbacon Well-Known Member

    Messages:
    1,231
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    173
    Articles:
    1
    #4
    I've played with that a bit. But i can't get the ads where i want them
     
    Canadianbacon, Sep 11, 2006 IP
  5. bigmack

    bigmack Well-Known Member

    Messages:
    175
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #5
    If your simply worried about positioning.. it's all about your "Module Position" and the order in which you put them.. You can adjust all that from the module manager, but you will be stuck with the actual positioning your template puts things in unless you wish to edit the file that determines where these positions are. I can't remember which file that is off the top of my head either.

    For example your voting module could be put in several positions such as top, left, right, etc.. and the order that module is placed in that position is determined in the module manager as well..
     
    bigmack, Sep 11, 2006 IP
  6. w8amoment

    w8amoment Well-Known Member

    Messages:
    975
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    120
    #6
    w8amoment, Sep 12, 2006 IP
  7. titoni

    titoni Active Member

    Messages:
    965
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    58
    #7
    With "Joomlaspan adsense module", you can put adsense on any position easily.
    In fact ,one place is very important,that is between title and content.
     
    titoni, Sep 12, 2006 IP