Thread: [Phpslash-devel] Variables.class
Brought to you by:
joestewart,
nhruby
From: Mike G. <mi...@op...> - 2003-07-29 14:19:17
|
In config.php in the CVS I think that you should be linking to Variable.class & not variable.class AddClassRequirement("variable",$_PSL['classdir'] . "/Variable.class"); How much is this class being used? Just got a question about trying to extend this class to allow folks to add global template variables. That's beyond what this class does now from what I understand, but it's an interesting concept. Mike -- Mike Gifford, OpenConcept Consulting Free Software for Social Change -> http://www.openconcept.ca Site Launch - Make Every Vote Count - http://www.fairvotecanada.org The cruelest lies are often told in silence. -- Robert L Stevenson |
From: Joe S. <joe...@us...> - 2003-07-29 15:57:54
|
On Tue, Jul 29, 2003 at 10:19:24AM -0400, Mike Gifford wrote: > In config.php in the CVS I think that you should be linking to > Variable.class & not variable.class > > AddClassRequirement("variable",$_PSL['classdir'] . "/Variable.class"); > thanks, will correct. > How much is this class being used? Just got a question about trying to > extend this class to allow folks to add global template variables. > That's beyond what this class does now from what I understand, but it's > an interesting concept. > The Variable class is not used at all currently. 0.5.3 had many variables in the db and had many queries to get them each page view. We worked hard to move to html templates and defining what's needed in the config text file. We discussed possibly using it again by loading variables from the db into the session to reduce repeated access issues. I think providing some of the basic common placeholder values to the template object when initiating it is a natural next step. We couldn't do this till we had a slashTemplate class. Now, we should be able to set things like rooturl, imageurl, etc. to be provided to all templates. thanks, Joe > Mike > -- > Mike Gifford, OpenConcept Consulting > Free Software for Social Change -> http://www.openconcept.ca > Site Launch - Make Every Vote Count - http://www.fairvotecanada.org > The cruelest lies are often told in silence. -- Robert L Stevenson > > |
From: Mike G. <mi...@op...> - 2003-07-29 16:42:28
|
Howdy Joe, On Tue, 2003-07-29 at 04:57, Joe Stewart wrote: > > How much is this class being used? Just got a question about trying to > > extend this class to allow folks to add global template variables. > > That's beyond what this class does now from what I understand, but it's > > an interesting concept. > The Variable class is not used at all currently. 0.5.3 had many variables > in the db and had many queries to get them each page view. We worked hard > to move to html templates and defining what's needed in the config text > file. Right... > We discussed possibly using it again by loading variables from the db into > the session to reduce repeated access issues. This makes sense.. Would be nice to be able to turn modules on/off via the web interface and customize other variables through the interface.. But wow.. Has it been 0.5.3 since it was used that way? That was a heck of a long time ago.. Speaking of modules, how is the phpSlash modules code going? > I think providing some of the basic common placeholder values to the > template object when initiating it is a natural next step. We couldn't do > this till we had a slashTemplate class. Now, we should be able to set > things like rooturl, imageurl, etc. to be provided to all templates. Is someone working on a slashTemplate class? Mike -- Mike Gifford, OpenConcept Consulting Free Software for Social Change -> http://www.openconcept.ca Site Launch - Make Every Vote Count - http://www.fairvotecanada.org The cruelest lies are often told in silence. -- Robert L Stevenson |
From: Joe S. <joe...@us...> - 2003-07-29 18:16:35
|
On Tue, Jul 29, 2003 at 12:13:27PM -0400, Mike Gifford wrote: > Howdy Joe, > > On Tue, 2003-07-29 at 04:57, Joe Stewart wrote: > > > How much is this class being used? Just got a question about trying to > > > extend this class to allow folks to add global template variables. > > > That's beyond what this class does now from what I understand, but it's > > > an interesting concept. > > The Variable class is not used at all currently. 0.5.3 had many variables > > in the db and had many queries to get them each page view. We worked hard > > to move to html templates and defining what's needed in the config text > > file. > > Right... > > > We discussed possibly using it again by loading variables from the db into > > the session to reduce repeated access issues. > > This makes sense.. Would be nice to be able to turn modules on/off via > the web interface and customize other variables through the interface.. > But wow.. Has it been 0.5.3 since it was used that way? That was a > heck of a long time ago.. > > Speaking of modules, how is the phpSlash modules code going? > Mostly stable. There is so much flexibility that you can really screw things up. Not sure how I like this part. Sometimes the bugs have been pretty harsh and unforgiving. A few nice things: Easily make a poll, etc on the front page instead of a list of stories. The about page can be a story or a block and not necessarily tied to text inside a template. Sections can have different headers and skins. If you don't use the TopicBar, you simply don't have that block. No worry about including the class, etc. You can have different footers for the two or three column page. This is important for all CSS pages ( no tables). > > I think providing some of the basic common placeholder values to the > > template object when initiating it is a natural next step. We couldn't do > > this till we had a slashTemplate class. Now, we should be able to set > > things like rooturl, imageurl, etc. to be provided to all templates. > > Is someone working on a slashTemplate class? > 0.7 includes the slashTemplate class that extends the phplib template class. This allows us to override the set_file method to use absolute paths, parent skins, template directories in the module's own directory, and as suggested, some initial values for commonly used template variables. Previously, we were just using the phplib template class. So we had keep up with the template directory and all variables everywhere. Joe > Mike > -- > Mike Gifford, OpenConcept Consulting > Free Software for Social Change -> http://www.openconcept.ca > Site Launch - Make Every Vote Count - http://www.fairvotecanada.org > The cruelest lies are often told in silence. -- Robert L Stevenson > |
From: Mike G. <mi...@op...> - 2003-07-29 20:07:16
|
Hi Joe, On Tue, 2003-07-29 at 07:14, Joe Stewart wrote: > > Speaking of modules, how is the phpSlash modules code going? > Mostly stable. There is so much flexibility that you can really screw > things up. Not sure how I like this part. That's the trouble when you give folks enough rope to hang themselves on. :) > Sometimes the bugs have been pretty harsh and unforgiving. How bad? Just nasty errors or no errors or worse lost data? > A few nice things: > Easily make a poll, etc on the front page instead of a list of stories. Ok.. > The about page can be a story or a block and not necessarily tied to text > inside a template. That's good.. > Sections can have different headers and skins. How did you set up the header customization? I'm not even sure where to start digging.. Is this just built into the standard classes now? > If you don't use the TopicBar, you simply don't have that block. No worry > about including the class, etc. There was some talk a while back about making everything a block.. Just depends on how you want to stack them.. > You can have different footers for the two or three column page. This is > important for all CSS pages ( no tables). Hm.. We haven't incorporated that piece yet.. But can't that all be done in the index1col -> index3cols templates? This hasn't been released yet.. Just in the standard CVS module at the moment, right? Just trying to figure out where your going so that we can support it with where we're going with BE at the moment. > > > I think providing some of the basic common placeholder values to the > > > template object when initiating it is a natural next step. We couldn't do > > > this till we had a slashTemplate class. Now, we should be able to set > > > things like rooturl, imageurl, etc. to be provided to all templates. > > Is someone working on a slashTemplate class? > 0.7 includes the slashTemplate class that extends the phplib template > class. This allows us to override the set_file method to use absolute > paths, parent skins, template directories in the module's own directory, > and as suggested, some initial values for commonly used template > variables. Right.. Thought it looked familiar.. just too many files to keep track of.. > Previously, we were just using the phplib template class. So we had keep > up with the template directory and all variables everywhere. So what needs to be done to allow template variables to be accessible in any template? Mike -- Mike Gifford, OpenConcept Consulting Free Software for Social Change -> http://www.openconcept.ca Site Launch - Make Every Vote Count - http://www.fairvotecanada.org The cruelest lies are often told in silence. -- Robert L Stevenson |
From: Joe S. <joe...@us...> - 2003-07-30 15:41:13
|
On Tue, Jul 29, 2003 at 03:46:28PM -0400, Mike Gifford wrote: > Hi Joe, > > On Tue, 2003-07-29 at 07:14, Joe Stewart wrote: > > > Speaking of modules, how is the phpSlash modules code going? > > Mostly stable. There is so much flexibility that you can really screw > > things up. Not sure how I like this part. > > That's the trouble when you give folks enough rope to hang themselves > on. :) > > > Sometimes the bugs have been pretty harsh and unforgiving. > > How bad? Just nasty errors or no errors or worse lost data? > No lost data. apache hanging was the worst. Otherwise, blank pages. > > Sections can have different headers and skins. > > How did you set up the header customization? I'm not even sure where to > start digging.. Is this just built into the standard classes now? > > > If you don't use the TopicBar, you simply don't have that block. No worry > > about including the class, etc. > > There was some talk a while back about making everything a block.. Just > depends on how you want to stack them.. > Pretty much everything is a block. The header is just a block assigned to the section. Use a different header template for different sections. So, those that wanted a more monolithic index page ( header and footer included) so that html editors view the entire page can do that too. > > You can have different footers for the two or three column page. This is > > important for all CSS pages ( no tables). > > Hm.. We haven't incorporated that piece yet.. But can't that all be > done in the index1col -> index3cols templates? > If you look at the index1,2&3 there is no reference to a footer, it was added by the index page. Tableless design using CSS only seems to have footer problems when the length of the side columns sometimes might be longer than the center column. This was noted by the Wired.com folks in their move too. Now there is a {TOP} and {BOTTOM}, so a footer can be in the CENTER or BOTTOM. > This hasn't been released yet.. Just in the standard CVS module at the > moment, right? > phpslash-dev cvs module <snip> > > So what needs to be done to allow template variables to be accessible in > any template? > To add certain variables to any template add something like this to the slashTemplate constructor: $this->set_var(array( 'QUERYSTRING' => $_SERVER['QUERY_STRING'], 'SITE_NAME' => $this->psl['site_name'], 'SITE_OWNER' => $this->psl['site_owner'], 'SITE_SLOGAN' => $this->psl['site_slogan'], 'SITE_TITLE' => $this->psl['site_title'], 'ROOTDIR' => $this->psl['rooturl'], 'IMAGEDIR' => $this->psl['imageurl'], 'SKIN' => $this->psl['skin'] )); Then we could get rid of setting the IMAGEDIR and ROOTDIR all over the place. There is some cleanup needed like ROOTURL/ROOTDIR, IMAGEURL/IMAGEDIR. I've experimented with only using one template instance. However, it was not faster in my limited tests. We use some common template variable names in multiple templates. This is used for repeating template blocks ( not phpSlash blocks ). i.e. BEGIN row, END row, etc. On one hand this is good because it simplifies use. However, you have problems doing this if you have only one template instance. Story and block options accept custom template variables also. If you add a block or story option that is not recognized, it is passed to the template as a variable. If there is one always needed, add it as a default option. Joe > Mike > -- > Mike Gifford, OpenConcept Consulting > Free Software for Social Change -> http://www.openconcept.ca > Site Launch - Make Every Vote Count - http://www.fairvotecanada.org > The cruelest lies are often told in silence. -- Robert L Stevenson > > |
From: Mike G. <mi...@op...> - 2003-07-30 17:48:56
|
Howdy Joe, On Wed, 2003-07-30 at 04:40, Joe Stewart wrote: > On Tue, Jul 29, 2003 at 03:46:28PM -0400, Mike Gifford wrote: > > On Tue, 2003-07-29 at 07:14, Joe Stewart wrote: > > > > Speaking of modules, how is the phpSlash modules code going? > > > Mostly stable. There is so much flexibility that you can really screw > > > things up. Not sure how I like this part. > > That's the trouble when you give folks enough rope to hang themselves > > on. :) > > > Sometimes the bugs have been pretty harsh and unforgiving. > > How bad? Just nasty errors or no errors or worse lost data? > apache hanging was the worst. Otherwise, blank pages. That's not all that bad.. As long as it's not on a production server. > > > Sections can have different headers and skins. > > How did you set up the header customization? I'm not even sure where to > > start digging.. Is this just built into the standard classes now? > > > If you don't use the TopicBar, you simply don't have that block. No worry > > > about including the class, etc. > > There was some talk a while back about making everything a block.. Just > > depends on how you want to stack them.. > Pretty much everything is a block. Can't get much more flexible than that. > The header is just a block assigned to the section. Use a different > header template for different sections. Can you also specify other body & footer templates? > So, those that wanted a more monolithic index page ( header and footer included) so that html editors view the entire page can do that too. That's a nice feature.. Folks liked the old single template/section from the old back-end.. > > > You can have different footers for the two or three column page. This is > > > important for all CSS pages ( no tables). > > Hm.. We haven't incorporated that piece yet.. But can't that all be > > done in the index1col -> index3cols templates? > If you look at the index1,2&3 there is no reference to a footer, it was > added by the index page. Tableless design using CSS only seems to have > footer problems when the length of the side columns sometimes might be longer than the center column. This was noted by the Wired.com folks in their move too. Ok.. This is all definitely new since the last time I've looked (from the index.php) // add page output to be displayed $output .= $template->parse('OUT','index'); // add header if not parsed above in index page template if( !$template->is_available('index','HEADER')) { $output = $header . $output; } // add footer if not parsed above in index page template if( !$template->is_available('index','FOOTER')) { $output .= $footer; } So if you want to just use the single template you'd just comment out these lines: // get page header and footer $header = getHeader($pagetitle,$_PSL['metatags']); $footer = getFooter(); > Now there is a {TOP} and {BOTTOM}, so a footer can be in the CENTER or BOTTOM. Ok.. > > This hasn't been released yet.. Just in the standard CVS module at the > > moment, right? > phpslash-dev cvs module I was using phpslash-ft I'll just go and grab the development version.. Just having trouble grabbing things from the CVS at the moment.. Might be just something odd with the SF CVS server.. cvs -d:pserver:ano...@cv...:/cvsroot/phpslash login cvs [login aborted]: end of file from server (consult above messages if any) cvs -z3 -d:pserver:ano...@cv...:/cvsroot/phpslash co phpslash-dev cvs [checkout aborted]: end of file from server (consult above messages if any) > > So what needs to be done to allow template variables to be accessible in > > any template? > To add certain variables to any template add something like this to the > slashTemplate constructor: > $this->set_var(array( > 'QUERYSTRING' => $_SERVER['QUERY_STRING'], > 'SITE_NAME' => $this->psl['site_name'], > 'SITE_OWNER' => $this->psl['site_owner'], > 'SITE_SLOGAN' => $this->psl['site_slogan'], > 'SITE_TITLE' => $this->psl['site_title'], > 'ROOTDIR' => $this->psl['rooturl'], > 'IMAGEDIR' => $this->psl['imageurl'], > 'SKIN' => $this->psl['skin'] > )); Great! That makes sense. > Then we could get rid of setting the IMAGEDIR and ROOTDIR all over the > place. There is some cleanup needed like ROOTURL/ROOTDIR, IMAGEURL/IMAGEDIR. So this should actually improve the performance to add it here.. > I've experimented with only using one template instance. However, it was > not faster in my limited tests. We use some common template variable > names in multiple templates. This is used for repeating template blocks ( > not phpSlash blocks ). i.e. BEGIN row, END row, etc. On one hand this is > good because it simplifies use. However, you have problems doing this if you have only one template instance. Right.. > Story and block options accept custom template variables also. If you add > a block or story option that is not recognized, it is passed to the > template as a variable. If there is one always needed, add it as a > default option. Yes.. That's a nice feature.. Mike -- Mike Gifford, OpenConcept Consulting Free Software for Social Change -> http://www.openconcept.ca Site Launch - Make Every Vote Count - http://www.fairvotecanada.org The cruelest lies are often told in silence. -- Robert L Stevenson |