3070 Posts in 869 Topics by 651 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 897 Views |
-
Control all descendants of a given class name

26 April 2011 at 3:05am
Hello,
My site structure :
ArticleHolder
------------ArticleHolder
------------------------Article
------------------------Article
------------------------Article
------------ArticleHolder
------------------------Article
------------------------Article
ArticleHolder
------------ArticleHolder
------------------------Article
------------------------Article
------------ArticleHolder
------------------------Article
------------------------Article
...I want to control all the Articles being descendant of any ArticleHolder page. No problem with direct children ; but what if the articles are grandchildren of my ArticleHolder page ?
What I did to solve this is :
1°/ replace the class name of my top level pages (new name : "TopArticleHolder")
TopArticleHolder
------------ArticleHolder
------------------------Article
TopArticleHolder
------------ArticleHolder
------------------------Article2°/ set a one-to-many relationship between my Articles and my TopArticleHolder Pages : every TopArticleHolder has many Articles, and every Article has one TopArticleHolder
3°/ include a HasOneComplexTableField in my Article.php file, so that I can tick the TopArticleHolder page of my article in the cms.
4°/ I can now control my Articles, sort them, etc. from my TopArticleHolder page template with <% control Articles %>
But I don't find this solution elegant at all !
Do you know any cleaner way to control grandchildren ?
If I have to stick to my solution, how can I define my has_one relationship by default, without my tablefield, given that an Article is always related to its top ascendant ?Thank you !
Stan
| 897 Views | ||
|
Page:
1
|
Go to Top |

