Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,462
    Plugin Contributions
    11

    Default Need variable help

    I'm working on a mod to display events for my customers that go to farmer's markets, flea markets, craft shows, etc.

    I'm trying to get the mod where it will universally "pickup" the database info from the installed config file.

    The code without variables is
    PHP Code:
    $opts['hn'] = 'localhost';
    $opts['un'] = 'freddy_fender';
    $opts['pw'] = 'antidisestablishmentarianism';
    $opts['db'] = 'fender_zc1';
    $opts['tb'] = 'events'
    Of course, everything is fictitious.

    It would be easier to use a database handler but, again, hard to standardize.

    I've tried several versions of variables for the above to no avail. i.e.
    PHP Code:
    $opts['hn'] = $SERVER['DB_SERVER']; 
    PHP Code:
    $opts['hn'] = $DB_SERVER
    I know someone will be able to point out the error of my ways.

  2. #2
    Join Date
    Oct 2007
    Location
    Los Angeles / Simi Valley
    Posts
    40
    Plugin Contributions
    0

    Default Re: Need variable help

    hum...

    Pick up from which config file???
    IF you are wanting to do that from the zencart config, then

    1) make sure that the config file is included in the page you are doing this in... if not add a requireonce() linking ot the config file
    2) use the variables defined here as such...
    PHP Code:
    $opts['hn'] = DB_SERVER;
    $opts['un'] = DB_SERVER_USERNAME;
    $opts['pw'] = DB_SERVER_PASSWORD;
    $opts['db'] = DB_DATABASE;
    $opts['tb'] = DB_PREFIX."TABLE NAME"
    I think thats what you ment.... altough i'm not sure what that has anything to do with displaying events for costumers that go to farmer markets O_o
    Need anything done on your zen cart Shop that other people said was impossible? send me a PM, I'll be happy to discuss the situation :)

  3. #3
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,462
    Plugin Contributions
    11

    Default Re: Need variable help


    Too many bowl games! Totally overlooked the requireonce()
    This mod will allow folks to advertise where they'll be set up.
    Puts "Scheduled Events" in the Information sidebox and lists start/stop dates, place, website, directions, and special info. All are shown based on whether or not something is entered in that block in the database.
    Was going to integrate event changes in the admin but will wait till 2.0 is stable to go there.
    Meanwhile, folks will have some way of letting customers know where their store is setup next.
    one example at enightlightsDOTcom.

    THANX for the wakeup

  4. #4
    Join Date
    Oct 2007
    Location
    Los Angeles / Simi Valley
    Posts
    40
    Plugin Contributions
    0

    Default Re: Need variable help

    Ok, makes more sense, but I think i understand now and you did not explain too clearly...

    this is a sidebox that will show a list of events--or whatever-- that is entered in the back end admin.

    if so you don't really need to include the database just use the Zen built in db query calls and output the data that way. all you really have to do is pull the info out of the DB with the given function and it will return an array that you can diractly use to loop through and echo out the events one by one...
    Need anything done on your zen cart Shop that other people said was impossible? send me a PM, I'll be happy to discuss the situation :)

  5. #5
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,462
    Plugin Contributions
    11

    Default Re: Need variable help

    Was being a little "cryptic" in order to not expose something I shouldn't. Not that what I'm doing is top secret, I didn't want to let too much out until I could test the security of the operation.
    The code is not for retrieving the data as I am using the built-in query calls.
    I am adding a line item to the information box for Scheduled Events and using standard zen to display them on their own page.
    The code is used for a simple system that allows admins to enter/edit events. A fill-in-the-form for those leery of or unfamiliar with database updates.
    It lets the user install the enter/edit files in a folder of their choice and then loads seven files into specific override folders on their site.
    With a few modifications, it can also be used to display Retail Outlets, Recipes, etc.

  6. #6
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    6,173
    Plugin Contributions
    0

    Default Re: Need variable help

    Dbltoe,
    I have just discovered 007 secret agent agent of the Zen Cart Forum

  7. #7
    Join Date
    Oct 2007
    Location
    Los Angeles / Simi Valley
    Posts
    40
    Plugin Contributions
    0

    Default Re: Need variable help

    yea, if you are making it a contrib what serves you being all cryptic ?

    it's a cool Idea, altought personally i doubth the typical store owner will find it useful as they barely know how to check their own orders
    Need anything done on your zen cart Shop that other people said was impossible? send me a PM, I'll be happy to discuss the situation :)

 

 

Similar Threads

  1. v154 Naming a global variable the same as a SESSION, GET or POST variable
    By torvista in forum General Questions
    Replies: 5
    Last Post: 6 Dec 2015, 11:11 AM
  2. v151 Need help w/ variable flat rate shipping due to item size
    By ogre in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 14 Oct 2013, 09:34 PM
  3. Need help adding $_SESSION variable
    By chadderuski in forum General Questions
    Replies: 4
    Last Post: 14 Jun 2010, 04:30 PM
  4. Need variables for idevaffiliate variable pass ons?
    By s2kinteg916 in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 31 May 2009, 07:41 PM
  5. Need Order Total Variable For iDevAffiliate
    By etrader in forum General Questions
    Replies: 5
    Last Post: 19 Jun 2006, 07:57 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR