Need some help creating small php function

Discussion in 'PHP' started by LiftBigEatBig, Apr 6, 2009.

  1. #1
    Hi there,

    I'm running a Joomla site. I have a module on the right hand side that displays when every article is shown. However, I want the contents of this module to be different for each article.

    This is what I'm thinking of doing, calling a php file in the module itself. In this php file I can have something like this:

    If (article #1)
    {
    do this
    }
    If (article #2)
    {
    do this
    }
    etc....

    As you can see I have an idea of the logic I want to use, but don't know the fine details of php programming. Any help is greatly appreciated!!!!
     
    LiftBigEatBig, Apr 6, 2009 IP
  2. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #2
    and just how many articles do you plan to do this for? I'm thinking 5-10, ok. 50+ that's insane.
    how to tackle this really depends on the content for the module, is it in a database, flat files?
     
    shallowink, Apr 6, 2009 IP
  3. LiftBigEatBig

    LiftBigEatBig Well-Known Member

    Messages:
    302
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    123
    #3
    I used the "Jumi" plugin to do this. But you are right, this really isn't an effective way to do this. Once the site gets over 100 files it might slow down the loading process. I have no clue how else to do it though.
     
    LiftBigEatBig, Apr 6, 2009 IP
  4. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #4
    I was thinking load and maintenance. I haven't used that plugin. If I was doing this, I would just build a compoment to query the database provided there is some way to connect articles to the right col data (article id or some such?)
     
    shallowink, Apr 6, 2009 IP