This is more of a update post for a UDT i used in guest post Articles on Arvixe Blog that is CMSMS Hosting Partner.
In case you missed those articles you will find these articles as "How to Add Content Summary for Search Results" and "Creating a Multilingual CMSMS Site Using MleCMS Module".
As there were some changes since CMSMS 1.10.x series, there is a good chance that the UDT mentioned in those articles will no longer work and the method used in the "How to Add Content Summary for Search Results" wasn't very reliable, as there is a good chance that you might have multiple pages with same Title.
To create the UDT go to "Extensions » User Defined Tags" and add a UDT, name it for example set_alias.
And this is the updated UDT code.
/** Get page alias from url
* @params string $params['url']
*/
$gCms = cmsms();
$cntnt = cmsms()->GetContentOperations();
foreach ($cntnt->GetAllContent() as $page)
{if ($page->GetURL() == $params['url']) {
$return = $page->Alias();
break;}}
if(!empty($params['assign'])){
$smarty = cmsms()->GetSmarty();
$smarty->assign(trim($params['assign']), $return);
}
else
{
return $return;
}
What is changed here? Well not much. The method we are using now is to retrive a page Alias from page URL instead of Title.
So to use the UDT simply use parameter url=, you can also use assign= to assign the UDT to a variable.
{set_alias url='http://www.your-site.com/some-page'} As the idea of this UDT was to retrive page alias in Search module results you would use it in Search module as following.
{set_alias url=$entry->url assign='get_alias'}
I absolutely love your blog and find a lot of your post's to be precisely what I'm looking for. Would you offer guest writers to write content for yourself? I wouldn't mind composing a post or elaborating on a lot of the subjects you write regarding here. Again, awesome blog!
Thank you, link is fixed now (i hope) :-)
The link for "How to Add Content Summary for Search Results" is not correct - it's always linked to CMSMle article