Mambo Module?

Discussion in 'Co-op Advertising Network' started by cafemonkey, Dec 11, 2004.

  1. #1
    I'm using Mambo CMS for my sites, and I made a basic module for the ad network.

    I'm happy to share this, however, I'm not a coder, so I don't know how to improve it much.

    So 2 things:

    1. If you want the module as I have it, PM me and I'll send it to you.

    2. If you know PHP/Mambo Modules let me know and I'll see if I can help improve this thing. Currently it installs properly, but you still have to manually setup the .txt file, and make manual changes to the include file if you want to change the number/type of ads. It really needs an admin page to allow changes.

    Thanks for the great tool guys!
     
    cafemonkey, Dec 11, 2004 IP
    wendydettmer likes this.
  2. payoutwindow

    payoutwindow Well-Known Member

    Messages:
    788
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #2
    I went with adding the code to the index.php of the live template, and it worked okay.
     
    payoutwindow, Dec 12, 2004 IP
  3. cafemonkey

    cafemonkey Peon

    Messages:
    44
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah, that works, but it's really a hack. The "spirit" of a content management system is to make it as modular as possible.

    Now, if you wanted to change templates, or use a template chooser, you'd have to hard-code the php into each template.

    If you have a working system, I wouldn't change it. But I thought I'd share in case someone else wanted to use a Mambo module.
     
    cafemonkey, Dec 12, 2004 IP
  4. suzigeek

    suzigeek Peon

    Messages:
    142
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can put the ad in the footer file which is in the includes folder. Most of the off the shelf templates include the footer in the templates.

    Thats how I did it with my mambo sites.
     
    suzigeek, Dec 12, 2004 IP
  5. cafemonkey

    cafemonkey Peon

    Messages:
    44
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Mamboforge project created here:

    mamboforge.net/projects/mod-coop-ad-net/
     
    cafemonkey, Dec 13, 2004 IP
  6. cafemonkey

    cafemonkey Peon

    Messages:
    44
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    OK good news!

    I've been working on the module all day, and I have something that works, and works well!

    The module installer works smoothly, it includes a radio button to change from horizontal to vertical ad alignment, lets you choose links, text, or text and banner, and now includes support for the ad_network_ads.txt file... So you don't have to manually create and modify this bugger again!

    www (dot) mamboforge.net/projects/mod-coop-ad-net/

    If you downloaded it earlier, be sure to upgrade. Upgrade instructions are in the documentation section of the project.
     
    cafemonkey, Dec 13, 2004 IP
  7. Hank

    Hank Guest

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    CafeMonkey:

    I installed your module. Great start.

    Prior to your tool, I've been tinkering with my footer and while I could get the ads to work on my mambo site, I had the PDF generator on previously, and google has about 200 PDF pages that will not get the ad network ads in.

    Anyway, after installing your module, I get this error:

    Fatal error: Call to undefined function: get() in /home/traints/public_html/modules/mod_coop_ad.php on line 53

    in the place on my site where the ads should display. Also, I get this error at the very top of my browser, before the header graphic:

    "; defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); ?>

    So not sure what's up there......

    Hank
     
    Hank, Dec 15, 2004 IP
  8. Hank

    Hank Guest

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Cafe: does your module modify any of the native mambo site templates?

    I can't seem to get rid of the error at the top of the page:

    "; defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); ?>

    I've reverted my index.php and footer.php back to prior versions with no luck. Any tips would be welcomed!

    Hank
     
    Hank, Dec 15, 2004 IP
  9. cafemonkey

    cafemonkey Peon

    Messages:
    44
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Hi Hank, got your email. Thanks for emailing me, cause I haven't checked this thread.

    I see your site, and I see that it still has this problem. PM me or email me your template html(php) file so I can take a look. That line shouldn't get passed to the html side, so we'll have to see where it's coming from.

    YES!! I have that problem all the time! But I've found that revalidating tries a different page, and it usually catches it after a few clicks. I've since turned off the PDF pages, but Google still has some indexed...

    What version of PHP are you running? Like I've said, I'm but much of a developer, but "get" seems like a pretty basic function. Maybe you could make a phpinfo page for me to look at?

    Thanks,

    Andy
     
    cafemonkey, Dec 17, 2004 IP
  10. jema

    jema Peon

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Thanks for this one, was about to try and do a module myself.

    jema
     
    jema, Dec 24, 2004 IP
  11. jema

    jema Peon

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Also get the:

    Fatal error: Call to undefined function: get() in /home/marsjupi/public_html/mambo/modules/mod_coop_ad.php on line 105

    error.

    jema
     
    jema, Dec 24, 2004 IP
  12. jema

    jema Peon

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Removing the "get" does make it work, not too sure on things though as I have jst started with this network, so am a but unclear on things.

    jema
     
    jema, Dec 24, 2004 IP
  13. jema

    jema Peon

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    jema, Dec 24, 2004 IP
  14. cafemonkey

    cafemonkey Peon

    Messages:
    44
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #14
    I just borrowed that "get" function from the "Main Menu" module. In my version (4.5.1) in modules/mod_mainmenu.php, line 89, I have this:
      if ( $params->get( 'menu_images' ) ) {  
    Code (markup):
    That gets the "menu_images" parameter from your Mambo admin page. Go to Modules -> Site Modules -> Main Menu -> Parameters tab. The "Show Menu Icons" controls the "menu_images" parameter.

    If you can run the main menu, you should be able to run the Coop Module.

    And, your message surprises me, because "get" is called earlier at line 53:
    $ad_type = $params->get( 'ad_type', 'link' );
    Code (markup):
    Removing that get line will make the ad work, you just won't be able to "select" from the Admin page which type of ad you want to use.

    Again, I'm not much of a coder, I just tinkered till it worked. If you can write more than 2 lines of code, you're qualified to be a lead developer on the project. ;-)
     
    cafemonkey, Dec 27, 2004 IP
  15. jema

    jema Peon

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    May be something about the "includes" that works differently. Perhaps you have othe rmodules loaded that give you access to the get function. I did replace a couple in the module to make things work.

    I will try and have more of a look, as I have done quite a lot of php :D

    jema
     
    jema, Dec 27, 2004 IP
  16. cafemonkey

    cafemonkey Peon

    Messages:
    44
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #16
    cafemonkey, Dec 28, 2004 IP
  17. jema

    jema Peon

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Maybe it is a problem if you are not on 4.51a?

    I am upgrading currently, so will be able to see if this resolves things.

    jema
     
    jema, Dec 28, 2004 IP
  18. cafemonkey

    cafemonkey Peon

    Messages:
    44
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #18
    cafemonkey, Dec 30, 2004 IP
  19. jema

    jema Peon

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    Sorry for not posting sooner. The 4.51a upgrade does resolve the issue :)

    thaks Cafemonkey.

    jema
     
    jema, Jan 3, 2005 IP
  20. cafemonkey

    cafemonkey Peon

    Messages:
    44
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #20
    cafemonkey, Jan 7, 2005 IP