[font="Lucida Sans Unicode"]Hi guys,
I have had a browse through the forum about this topic, but didn’t come across anything specifically dealing with my question.
I am fairly new to Yii, however would like to solve my problem in a generic and elegant way if possible, without implementing any dirty hacks if that makes sense
I am sure I am not the first person trying to work out a solution for this topic.
I am planning to use several content views (both static and dynamic ones) as part of my project, whilst using a generic layout-view.
Now, for purposes of SEO,etc. I would like to have proper and expressive meta-tags set in the head area of my HTML document, depending on the respective content view chosen by my controller.
I have currently drafted a solution which looks like this:
Set up a table in DB where I am storing(/configuring) relevant information (incl. meta information and page title,…) per content page.
I derived and extended controler class from CController by properties for pageAuthor, pageRobots, pageKeywords,… (whichever meta information I need), which I am deriving my actually used controller from.
Before rendering my page (beforeRender) I am trying to fetch matching record from my backend-DB (identified via controller_id, action_id and view_name) and populate my attributes with it.
Via registerMetaTag() I am setting my meta tags based on information fetched from DB
Tags are nicely generated during rendering and principally all works fine
Now whilst my approach is generally working and as it is such a basic requirement for almost every website as I think, I was wondering whether anyone is aware about some more generic/elegant approach or some existing extension which can be used to accomplish this task?
Any advice would be appreciated.[/font]