-
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.:frusty: 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.
-
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
-
Re: Need variable help
:blush:
Too many bowl games! Totally overlooked the requireonce():lamo:
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
-
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...
-
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.
-
Re: Need variable help
Dbltoe,
I have just discovered 007 secret agent agent of the Zen Cart Forum
-
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 :P