Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2006
    Posts
    11
    Plugin Contributions
    0

    Default How can i call a php file that does some processing?

    Hi,

    I am having alot of difficulties trying to understand how to add a php file which does some processing and then returns me to the referring page.

    For instance:

    I have a file e.g. myFile.php

    Which does some processing and at the end, executes a return to the referring page e.g.

    header("Location: $referer");
    exit;



    Because i want to follow zencart's data /coding structure as close as possible

    My question is:

    1) Should i define the link as:

    index.php?main_page=myFile.php&a=1&b=2 ...

    or

    index.php?main_page=myFile&a=1&b=2 ...


    i.e. with or without the .php ending? and why the difference?

    (I know the in the function: zen_href_link() the variable that does this is called $static)


    2) Where do i put myFile or myFile.php so that it gets called properly?? Bearing in mind that it just executes some php code and is not a 'template' page or a displayed page?


    Please if anyone can give me some hints, i would be extremely grateful!

    Thanks in advance.

    yM

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,514
    Plugin Contributions
    126

    Default Re: How can i call a php file that does some processing?

    Don't think "call" and "return" like a programming language; this is a preprocessing step done by your web server, so think "include," as in Apache SSI.

    Look up "include" and "require" on php.net (or in your favorite PHP book) and you'll see how it works.

    Good luck,
    Scott
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Aug 2006
    Posts
    11
    Plugin Contributions
    0

    Default Re: How can i call a php file that does some processing?

    Thanks SWGuy,

    ...my question is really to do with zencart rather than a php programming issue.


    I just would like to know where, amongst the zencart directory structures, should i put myFile.php so that one of these href link will find myFile?

    index.php?main_page=myFile&a=1&b=2 ...


    Another way of looking at it is:

    "If i click on that link, what are the sequence of files do ZC loads (include) to display myFile"


    Thanks in advance.

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,514
    Plugin Contributions
    126

    Default Re: How can i call a php file that does some processing?

    You're asking a couple of questions here, so I'm going to give a couple of answers. :)

    1) This seems like a new page. If it's a completely new page you're introducing, look at the About Us contribution in the downloads area for an example of how to do this.
    2) This seems like the modification of an existing page. If you're just including some code into an existing page, just use include or require. Put the new code as close as possible to the old code, in a template folder - mostly so you'll remember where you put it three months from now.

    Hope this helps,
    Scott
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. v155 How to call a php file localized in modules fold
    By su35 in forum General Questions
    Replies: 2
    Last Post: 26 Jul 2016, 09:05 PM
  2. How can you do a special that does not affect options prices?
    By karma-lab in forum Setting Up Specials and SaleMaker
    Replies: 6
    Last Post: 2 Jun 2008, 05:46 AM
  3. can some one give me meta_data.php file pls!
    By what44 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 5 Dec 2007, 04:36 PM
  4. Replies: 12
    Last Post: 8 Apr 2007, 03:36 PM
  5. How to eliminate some sections of a PHP file?
    By Peace Freak in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 22 Aug 2006, 05:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg