From: Justin Collins Date: 2008-02-20T08:27:02+09:00 Subject: Re: Newbie eRuby site design question Peter Woodsky wrote: > Hi list > I'm designing a dynamic site using eruby/mod_ruby and so far its coming > together pretty well but I'm stuck on something and could use some help. > I have a config file (out of the web root) that I'm using to set params > and vars. I'd rather not embed a db select into my pages but rather have > it in my config and just call the data from a var but nothing I've tried > works. > > example > > //in config// > row = dbh.select_one("select banner,title,message,image from contents;") > banner = "#{row[0]}"; title = "#{row[1]}"; message = "#{row[2]}"; image > = "#{row[3]}" > > //in web page// > >
>
> [menu] >
>
>
<%=title%>
>
<%=message%>
>
>
border="0">
>
> > How do I define the output from the select so I can use it in my page? > In the above example I get errors that banner, title, message, image are > not defined. > > Any help is appreciated. > > Thanks!! > Try using ERuby.import("config.rb") at the top of your page to parse and run the config file first. -Justin