From: Eloi G. <el...@re...> - 2003-07-06 16:46:04
|
I've figured out a way to let modules change Layout's metatags on a "per page view" basis. I'd like to hear what you guys think. I didn't have it manage the title tag because there's already a $GLOBALS['Layout_title'] to handle that, but for code conformity it can be easily modified to handle that as well. USAGE: Just assign desired tag contents to the appropriate array element. It'll clean up after itself. EXAMPLE: $_SESSION['OBJ_layout']->meta_vars['meta_description'] = 'This is the best CMS in the world!'; -Eloi George- In /mod/layout/class/layout.php add the following at line 211: /** * Content array for "one time only" meta tags specified by modules * * @var string * @access private */ var $meta_vars; then replace function getMetaTags with this one: function getMetaTags(){ $metatags = "<meta name=\"generator\" content=\"phpWebSite\" />\n"; if (isset($this->meta_vars['meta_keywords'])) $metatags .= "<meta name=\"keywords\" content=\"".$this->meta_vars['meta_keywords']."\" />\n"; elseif ($this->meta_keywords) $metatags .= "<meta name=\"keywords\" content=\"".$this->meta_keywords."\" />\n"; if (isset($this->meta_vars['meta_description'])) $metatags .= "<meta name=\"description\" content=\"".$this->meta_vars['meta_description']."\" />\n"; elseif ($this->meta_description) $metatags .= "<meta name=\"description\" content=\"".$this->meta_description."\" />\n"; if ($this->meta_robots){ switch ($this->meta_robots){ case "00": $metatags .= "<meta name=\"robots\" content=\"noindex, nofollow\" />\n"; break; case "01": $metatags .= "<meta name=\"robots\" content=\"noindex, follow\" />\n"; break; case "10": $metatags .= "<meta name=\"robots\" content=\"index, nofollow\" />\n"; break; case "11": $metatags .= "<meta name=\"robots\" content=\"index, follow\" />\n"; break; } } if (isset($this->meta_vars['meta_author'])) $metatags .= "<meta name=\"author\" content=\"".$this->meta_vars['meta_author']."\" />\n"; elseif ($this->meta_author) $metatags .= "<meta name=\"author\" content=\"".$this->meta_author."\" />\n"; if (isset($this->meta_vars['meta_owner'])) $metatags .= "<meta name=\"owner\" content=\"".$this->meta_vars['meta_owner']."\" />\n"; elseif ($this->meta_owner) $metatags .= "<meta name=\"owner\" content=\"".$this->meta_owner."\" />\n"; if (isset($this->meta_vars['meta_content'])) $metatags .= "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . $this->meta_vars['meta_content']."\" />\n"; elseif ($this->meta_content) $metatags .= "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . $this->meta_content."\" />\n"; /* Erase the temporary tags */ $this->meta_vars = array(); return $metatags; } |
From: Richard S. <ri...@ri...> - 2003-07-07 01:51:26
|
I personally think thats great and should be implemented :-) I think it will be cool to change the theme on a page by page basis also if the user wanted to. I want to develop a site with different categories and would like the ability to change the look and feel of the site depending on the category they are in. I think it will be a great and unique feature of they CMS that no other one has so far but it's just an idea. What do you guys think? Anyways.... +1 for Eloi On Sunday, July 6, 2003, at 10:45 AM, Eloi George wrote: > I've figured out a way to let modules change Layout's metatags on a > "per page view" basis. I'd like to hear what you guys think. I > didn't have it manage the title tag because there's already a > $GLOBALS['Layout_title'] to handle that, but for code conformity it > can be easily modified to handle that as well. > > USAGE: Just assign desired tag contents to the appropriate array > element. It'll clean up after itself. > EXAMPLE: $_SESSION['OBJ_layout']->meta_vars['meta_description'] = > 'This is the best CMS in the world!'; > > -Eloi George- > > In /mod/layout/class/layout.php add the following at line 211: > > /** > * Content array for "one time only" meta tags specified by modules > * > * @var string > * @access private > */ > var $meta_vars; > > then replace function getMetaTags with this one: > > function getMetaTags(){ > $metatags = "<meta name=\"generator\" content=\"phpWebSite\" />\n"; > > if (isset($this->meta_vars['meta_keywords'])) > $metatags .= "<meta name=\"keywords\" > content=\"".$this->meta_vars['meta_keywords']."\" />\n"; > elseif ($this->meta_keywords) > $metatags .= "<meta name=\"keywords\" > content=\"".$this->meta_keywords."\" />\n"; > > if (isset($this->meta_vars['meta_description'])) > $metatags .= "<meta name=\"description\" > content=\"".$this->meta_vars['meta_description']."\" />\n"; > elseif ($this->meta_description) > $metatags .= "<meta name=\"description\" > content=\"".$this->meta_description."\" />\n"; > > if ($this->meta_robots){ > switch ($this->meta_robots){ > case "00": > $metatags .= "<meta name=\"robots\" content=\"noindex, nofollow\" > />\n"; > break; > > case "01": > $metatags .= "<meta name=\"robots\" content=\"noindex, follow\" > />\n"; > break; > > case "10": > $metatags .= "<meta name=\"robots\" content=\"index, nofollow\" > />\n"; > break; > > case "11": > $metatags .= "<meta name=\"robots\" content=\"index, follow\" />\n"; > break; > } > } > > if (isset($this->meta_vars['meta_author'])) > $metatags .= "<meta name=\"author\" > content=\"".$this->meta_vars['meta_author']."\" />\n"; > elseif ($this->meta_author) > $metatags .= "<meta name=\"author\" > content=\"".$this->meta_author."\" />\n"; > > if (isset($this->meta_vars['meta_owner'])) > $metatags .= "<meta name=\"owner\" > content=\"".$this->meta_vars['meta_owner']."\" />\n"; > elseif ($this->meta_owner) > $metatags .= "<meta name=\"owner\" > content=\"".$this->meta_owner."\" />\n"; > > if (isset($this->meta_vars['meta_content'])) > $metatags .= "<meta http-equiv=\"content-type\" > content=\"text/html; charset=" . $this->meta_vars['meta_content']."\" > />\n"; > elseif ($this->meta_content) > $metatags .= "<meta http-equiv=\"content-type\" > content=\"text/html; charset=" . $this->meta_content."\" />\n"; > > /* Erase the temporary tags */ > $this->meta_vars = array(); > return $metatags; > } > > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/ > 01 > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers > > |
From: Matthew M. <ma...@tu...> - 2003-07-07 12:23:56
|
> I think it will be cool to change the theme on a page by page basis > also if the user wanted to. Planned for 0.9.4. Matthew McNaney Internet Systems Architect Electronic Student Services Appalachian State University Phone: 828-262-6493 phpwebsite.appstate.edu ess.appstate.edu |
From: Matthew M. <ma...@tu...> - 2003-07-07 12:20:16
|
> I've figured out a way to let modules change Layout's metatags on a "per > page view" basis. I'd like to hear what you guys think. I think this a good idea. I will incorporate these abilities in the 0.9.4 version of Layout. Matthew McNaney Internet Systems Architect Electronic Student Services Appalachian State University Phone: 828-262-6493 phpwebsite.appstate.edu ess.appstate.edu |