Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

get vars from config for ADODB connection

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
assbach
Smarty Rookie


Joined: 21 Jun 2003
Posts: 11

PostPosted: Sat Jun 21, 2003 11:56 am    Post subject: get vars from config for ADODB connection Reply with quote

hi there,

i quite new to smarty and i am using it in combination with ADODB.
now i have set my database connection vars in the "xy.conf" file
and want to access them in my php-file....

look please:

xy.conf
---------
# hidden section
[.Database]
dbHost = localhost
dbName = name
dbUser = user
dbPass = 123456pass

xy.php
--------

Code:

<?php

require '/path/smarty/libs/Smarty.class.php';
$smarty = new Smarty;
$smarty->caching = false;
$smarty->compile_check = true;

$smarty->config_load('xy.conf','Database');
$dbPass = $smarty->get_config_vars('dbPass');

require '/path/adodb/adodb.inc.php';


$db=NewADOConnection('mysql');
$db->Connect("localhost", "name", $dbPass, "user");

?>






how is the syntax? what's wrong? is there a way to do this anyway?i also tried {#dbpass#} and so on... $smarty.dbPass

please advice ... thanks alot,
sascha
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Jun 25, 2003 5:50 am    Post subject: Reply with quote

hi assbach.

What version of Smarty? There is a problem with 2.5.0 if your file starts immediately with a section. Try a blank line or comment before the section to see if that helps. There is more info on this issue available HERE.

Note that the issue discussed in that topic is corrected in CVS but that the current CVS is undergoing a lot of changes and is unstable for production work.
Back to top
View user's profile Send private message
assbach
Smarty Rookie


Joined: 21 Jun 2003
Posts: 11

PostPosted: Thu Jul 03, 2003 2:44 pm    Post subject: Reply with quote

indeed, it's 2.5.0

i'm gonna try what you said,
but which syntax/way is correct then?
Back to top
View user's profile Send private message
assbach
Smarty Rookie


Joined: 21 Jun 2003
Posts: 11

PostPosted: Thu Jul 03, 2003 2:51 pm    Post subject: Reply with quote

it seems to work, thanks alot!!!!!
Very Happy

BUT only with unhidden sections?!?

as soon as i put a DOT before the section name - it does not work anymore.?!? puzzled.

even with the "hack" it doesnt work for me...

Sad
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP