Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
Using PN variables in PHP script
  • Posted: 17.07.2005, 20:14
     
    w8zf
    rank:
    Freshman Freshman
    registered:
     May 2005
    Status:
    offline
    last visit:
    19.01.07
    Posts:
    18
    I am trying to find out how to use core variables in my script. I wrote a small PHP script to read a admin-uploaded CSV (comma delimited text) file. The purpose is to display the results in a self-labeling, self-sizing HTML table. For those with admin privilege, I want them to be able to view the entire table. For registered users, I want my for/next loop to filter out all the entries with data for other people, allowing them to see only their own data. The CSV file will contain an entry with some PN identifier, like username or ID number. My question is, how does my PHP script access and reference this variable from the MySQL table in PN. I need to check each line of the file and reject it for registered users unless they match the line data. Likewise, given the user's ID, I need to check his privilege level to see if he can see the whole table, or just his line in the table. I suspect I'll have to connect to the database (I think I have seen PHP code in some of the modules for this), but maybe there's some easy Smarty Template way to access this variable which should PN should already know for the user's instance.

    Any help would be appreciated. I did a search, but it's WAY too much info -- try looking up something like 'variables', and you get too much material to look through.

    Thanks in advance,
    Dean
  • Posted: 17.07.2005, 20:41
     
    alarconcepts
    rank:
    Professional Professional
    registered:
     April 2004
    Status:
    offline
    last visit:
    21.01.08
    Posts:
    2723
    Have a look at the pnAPI Reference Guide...

    :)

    --
    Photography | PHP | Other
  • Posted: 17.07.2005, 23:38
     
    w8zf
    rank:
    Freshman Freshman
    registered:
     May 2005
    Status:
    offline
    last visit:
    19.01.07
    Posts:
    18
    Thanks! I think this is just what I was looking for! Hopefully, I'll be able to figure it out.
    Regards,
    Dean
  • Posted: 18.07.2005, 01:54
     
    alarconcepts
    rank:
    Professional Professional
    registered:
     April 2004
    Status:
    offline
    last visit:
    21.01.08
    Posts:
    2723
    No problem...I think you'll be alright... ;)

    --
    Photography | PHP | Other
  • Posted: 19.07.2005, 21:17
     
    w8zf
    rank:
    Freshman Freshman
    registered:
     May 2005
    Status:
    offline
    last visit:
    19.01.07
    Posts:
    18
    Thanks again for your help! I'm busy looking at documentation and trying to understand the way all this fits together. One difficulty I have is that I am chained to my PC to read anything. The docs appear to be presented only in HTML form, and in some cases, it is not even possible to use select/print to print only the relevant info (without getting all the PN side blocks, etc.).

    Is the pnAPI documentation available in a downloadable, printable form? I want something I can take out to the park, pool, whatever, and read through the code. I have looked, and searched the forum wihout success.

    Thanks again. Don't want to be a pain...

    Dean

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula