1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Difficulty adding PHP script to template

Discussion in 'PHP' started by egdcltd, Apr 19, 2005.

  1. #1
    What I am trying to do is add a PHP command to a page. However, allthough the page is PHP, to modify it the script is template driven, and it appears to ignore PHP when I add it to the template. I have tried it with a command I know should work, include, but nothing happens. I am actually trying to displaye a variable on a user page. Can anyone offer any suggestions please?
     
    egdcltd, Apr 19, 2005 IP
  2. flak

    flak GoogleMonkey

    Messages:
    77
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Is it the Biz Directory script?
     
    flak, Apr 19, 2005 IP
  3. palespyder

    palespyder Psycho Ninja

    Messages:
    1,254
    Likes Received:
    98
    Best Answers:
    0
    Trophy Points:
    168
    #3
    Agree with flak, in order to provide the best possible help we will need to know what the script is. Is it using Smarty as the templating engine? Is it the biz directory script? The reason being that PHP will be implemented in 2 totally seperate ways for these two options.
     
    palespyder, Apr 19, 2005 IP
  4. egdcltd

    egdcltd Peon

    Messages:
    691
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #4
    No, it isn't using Smarty, or the biz template script, it's Article Spider, if you've heard of it.
     
    egdcltd, Apr 19, 2005 IP
  5. palespyder

    palespyder Psycho Ninja

    Messages:
    1,254
    Likes Received:
    98
    Best Answers:
    0
    Trophy Points:
    168
    #5
    Not heard of that one. Got a link for a download so I can peep the termplate files?
     
    palespyder, Apr 19, 2005 IP
  6. egdcltd

    egdcltd Peon

    Messages:
    691
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Would the following be sufficient?
    SQL for templates
    PHP for page I am trying to add command to
    PHP for page I want to copy command from
     
    egdcltd, Apr 19, 2005 IP
  7. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #7
    To display a variable to a page you have to emmbed a php variable in the template and parse the template or have a mixed php/html page formatted correctly which is not hard.

    To get the client to run php code, you need to know what they are going to do, collect the data for the command to run from the user via an HTML form that posts to the php file and executes the commend and then displays the result.

    Hope that helps.
     
    noppid, Apr 19, 2005 IP
  8. egdcltd

    egdcltd Peon

    Messages:
    691
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Kind of. Unfortunately, my knowledge of PHP isn't that great, and I don't think I know how to do it. I was trying to include the following command:
    <?php echo $totalRows_rs_keyws ?>
    PHP:
    , but wasn't getting anywhere. I tried a simple include and got nowhere with that either, which led me to believe the problem was with the template system
     
    egdcltd, Apr 20, 2005 IP
  9. palespyder

    palespyder Psycho Ninja

    Messages:
    1,254
    Likes Received:
    98
    Best Answers:
    0
    Trophy Points:
    168
    #9
    Sorry I didn't get back on this yesterday. Does the script have anywhere in one of the templates where one is defined? For example smarty uses {$var} to return variables defined using $smarty->assign('var', $value);. If you will send me a link to download the script I can give a better quality answer.
     
    palespyder, Apr 20, 2005 IP
  10. egdcltd

    egdcltd Peon

    Messages:
    691
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #10
    The script is purchased, so I'm not sure if I am (legally) allowed to let you download it. Actually, I'm pretty sure I'm not. I could send you some of the files, if you wish; say, the ones I have been trying to alter/take code from
     
    egdcltd, Apr 21, 2005 IP
  11. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #11
    If the template is html, put this is .htaccess...

    AddType application/x-httpd-php .php .html

    in the folder with the html file you want to include from.
     
    noppid, Apr 21, 2005 IP
  12. egdcltd

    egdcltd Peon

    Messages:
    691
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Whilst the template is in HTML, it is saved in MySQL, not as an HTML file.
     
    egdcltd, Apr 22, 2005 IP
  13. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #13
    So? How does it get in the MYSQL DB?

    Let me answer that, PHP! :)
     
    noppid, Apr 22, 2005 IP
  14. egdcltd

    egdcltd Peon

    Messages:
    691
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Aargh! I'm still not getting anywhere. And I'm only up to Ch 2 in PHP & MySQL for Dummies
     
    egdcltd, Apr 23, 2005 IP
  15. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #15
    Don't be so hard on yourself, I've been programming way past chapter 2 for a while now and still look up stuff daily.

    Remember, you are learning HTML, PHP and MySql. Not just php.
     
    noppid, Apr 23, 2005 IP
  16. Revenant

    Revenant Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    to include anything within a template engine, this should be globally allowed.

    {include file="$EXAMPLE_DIR/example.html"}

    fyi, i know this reply is incredibly late, but i wanted to leave it out there for future reference.
     
    Revenant, Apr 16, 2006 IP