Blog Sections Open
Practical SiteContent Model Examples in Evolution CMS
Modern Evolution CMS examples for querying SiteContent with TVs, tree methods, sorting, and breadcrumb-style lookups.
One of the most useful changes in modern Evolution CMS is that document queries no longer have to start with DocLister. If you want tighter control, you can query SiteContent directly through Eloquent-style methods and still work with TVs, tree relations, sorting, and pagination.
The original request behind this article asked for a real replacement map: how to fetch news from nested sections, how to paginate, how to sort by an explicit order, how to build menus, and how to work with breadcrumbs. Those are exactly the cases where SiteContent examples help developers move from classic snippets to modern model-based code.
Querying documents with TVs
use EvolutionCMS\Models\SiteContent;
$docs = SiteContent::withTVs(['price', 'brand'])
->active()
->where('parent', 0)
->tvFilter("tv:price:>:150:UNSIGNED;tv:brand:!null;")
->tvOrderBy("price asc UNSIGNED, brand asc")
->orderBy('pagetitle', 'asc')
->get();Working with tvList when the TV count is high
$result = SiteContent::where('parent', 0)
->active()
->get();
$docs = SiteContent::tvList($result, ['price', 'brand']);tagsData and date-aware ordering
$docs = SiteContent::where('parent', 1)
->active()
->tagsData('17:5,7,8')
->orderByDate()
->get();Tree queries and breadcrumb-style lookups
$docs = SiteContent::GetRootTree(2)
->withTVs(['test'], ':', true)
->get()
->toTree()
->toArray();
$trail = SiteContent::find(7)
->ancestors()
->orderBy('depth', 'desc')
->get();Useful cases to start with
- listing news across nested sections with TV sorting
- filtering products by TV values
- building menus and breadcrumb trails from the closure table
- replacing one-off DocLister calls inside controllers and package routes
If you want a deeper reference, the gist version goes further into closure-table methods, descendant traversal, root-tree output, and typed TV filters. The important idea is not to rewrite everything at once. Start with one listing or one menu, reproduce it with SiteContent, and keep the patterns you can read and test comfortably.
Reference examples: Evo 3 SiteContent Model examples. Related package context: DLSiteContent.
Improving Manager Document Search for Non-Admin Users in Evolution CMS 3.1.6
How to make manager-side document search behave correctly for non-admin users in Evolution CMS 3.1.6 when document group logic gets in the way.
Stripping HTML Tags from Resource Content Safely
Use output modifiers to turn HTML-rich resource content into plain text for XML feeds and clean exports.