GetConfig(); $fileTimeIS=filemtime($File); $File= str_replace($config['root_path'], "", $File); $newPath = $File."?".$fileTimeIS; return $newPath; } function GetCategoriesNamesForCompany($path,$id){ $entryarray = array(); global $gCms; $db =& $gCms->GetDB(); $query = 'SELECT * FROM '.cms_db_prefix().'module_compdir_company_categories AS c ' .'LEFT JOIN '.cms_db_prefix().'module_compdir_categories AS a ' .'ON c.category_id = a.id WHERE c.company_id = ?'; $result = $db->Execute($query, array($id)); while ($result && !$result->EOF){ $entryarray[]=$result->fields['name']; $result->MoveNext(); } return $entryarray; } function GetCategoryName($path,$id){ global $gCms; $db =& $gCms->GetDB(); $query = 'SELECT * FROM '.cms_db_prefix().'module_products_categories ' .'WHERE id = ?'; $result = $db->Execute($query, array($id)); while ($result && !$result->EOF){ return $result->fields['name']; } } function GetCGBlogArticleUrl($path,$title,$detailpageID=''){ global $gCms; $CGBlog = $gCms->modules['CGBlog']['object']; $config =& $gCms->GetConfig(); $Bid=$title; $db =& $gCms->GetDB(); if(is_numeric($Bid)){ $query = 'SELECT cgblog_title FROM '.cms_db_prefix()."module_cgblog WHERE cgblog_id=?"; $row2 = $db->GetRow($query, array($Bid)); if ($row2){ $title = $row2['cgblog_title']; $count++; } }else{ $query = 'SELECT cgblog_id FROM '.cms_db_prefix()."module_cgblog WHERE cgblog_title=?"; $row2 = $db->GetRow($query, array($title)); if ($row2){ $Bid = $row2['cgblog_id']; $count++; } } $aliased_title = munge_string_to_url($title); $prettyurl = $CGBlog->GetPreference('urlprefix','cgblog').'/'.$Bid.'/'.$detailpageID."/$aliased_title".$config['page_extension']; if( $CGBlog->GetPreference('default_detailpage',-1) != -1 && $detailpageID==''){ $prettyurl = $CGBlog->GetPreference('urlprefix','cgblog').'/'.$Bid.'/'.$CGBlog->GetPreference('default_detailpage')."/$aliased_title".$config['page_extension']; } return $prettyurl; } function News_next_prev($path,$currdate,$Cat=null){ if($Cat!=null){ $queryN = "SELECT * FROM ".cms_db_prefix()."module_news AS a LEFT JOIN ".cms_db_prefix()."module_news_categories AS b ON a.news_category_id=b.news_category_id WHERE a.news_date>'$currdate' AND b.news_category_name='$Cat' AND a.status = 'published' ORDER BY a.news_date DESC LIMIT 1 "; $queryP = "SELECT * FROM ".cms_db_prefix()."module_news AS a LEFT JOIN ".cms_db_prefix()."module_news_categories AS b ON a.news_category_id=b.news_category_id WHERE a.news_date<'$currdate' AND b.news_category_name='$Cat' AND a.status = 'published' ORDER BY a.news_date DESC LIMIT 1 "; }else{ $queryN = "SELECT * FROM ".cms_db_prefix()."module_news AS a WHERE a.news_date>'$currdate' AND a.status = 'published' ORDER BY a.news_date DESC LIMIT 1 "; $queryP = "SELECT * FROM ".cms_db_prefix()."module_news AS a WHERE a.news_date<'$currdate' AND a.status = 'published' ORDER BY a.news_date DESC LIMIT 1 "; } global $gCms; $db =& $gCms->GetDB(); $result = $db->Execute($queryN); if ($result && $result->RecordCount() > 0){ $row = $result->FetchRow(); $result_next_NAME= $row['news_title']; $result_next_ID= $row['news_id']; } $result = $db->Execute($queryP); if ($result && $result->RecordCount() > 0){ $row = $result->FetchRow(); $result_prev_NAME= $row['news_title']; $result_prev_ID= $row['news_id']; } //$news = MyGetModuleInstance('News'); $news = $gCms->modules['News']['object']; $pageid = $gCms->smarty->_tpl_vars['page_id']; if($result_next_ID) { $aliased_title = munge_string_to_url($result_prev_NAME); $prettyurl = 'news/' . $result_next_ID .'/'.$pageid."/$aliased_title"; $next_uri = $news->CreateLink('cntnt01', 'detail', $pageid, '', array('articleid' => $result_next_ID) ,'', true, false, '', true, $prettyurl); }else{ $next_uri = ""; } if($result_prev_ID) { $aliased_title = munge_string_to_url($result_prev_NAME); $prettyurl = 'news/' . $result_prev_ID .'/'.$pageid."/$aliased_title"; $prev_uri = $news->CreateLink('cntnt02', 'detail', $pageid, '', array('articleid' => $result_prev_ID) ,'', true, false, '', true, $prettyurl); }else{ $prev_uri = ""; } $gCms->smarty->assign('news_next_url', $next_uri); $gCms->smarty->assign('news_prev_url', $prev_uri); $gCms->smarty->assign('news_next_text', $result_next_NAME); $gCms->smarty->assign('news_prev_text', $result_prev_NAME); } } function smarty_cms_function_modslack($params, &$smarty) { global $gCms; $config =& $gCms->GetConfig(); //get and set the parameters $function = isset($params['Func']) ? $params['Func']:''; $param1 = isset($params['param1']) ? $params['param1']:''; $param2 = isset($params['param2']) ? $params['param2']:''; $param3 = isset($params['param3']) ? $params['param3']:''; $param4 = isset($params['param4']) ? $params['param4']:''; $param5 = isset($params['param5']) ? $params['param5']:''; $assign = isset($params['assign']) ? $params['assign']:''; $path = isset($params['path']) ? $params['path']:false; if($path!=false){ $path=$config['root_path'].$path; } //object model :: $ModSlackOBJ->$function($path,$param1,$param2,$param2,$param2,$param5); $ModSlackOBJ = new modslack(); $OutCome = $ModSlackOBJ->$function($path,$param1,$param2,$param2,$param2,$param5); if($assign!=''){ $smarty->assign($assign,$OutCome); }else{ echo $OutCome; } } function smarty_cms_help_function_modslack() { ?>
... that you wished was in a module well this is where I have been sticking mine.
Please feel free to Let me know if you find more.
{if $smarty.get.cntnt01categoryid !=""}
{modslack Func=GetCategoryName param1=$smarty.get.cntnt01categoryid assign=cat}
{cms_module module="TruetypeText" style="titles" text="- $cat"}
{/if}<link rel="stylesheet" href="{modslack Func=fileTime path='/uploads/lib/CSS/Master.css'}" type="text/css" media="screen" />
<script type="text/javascript" src="{modslack Func=fileTime path='/uploads/lib/JS/MasterCore.js'}"></script>
<script type="text/javascript" src="{modslack Func=fileTime path='/uploads/lib/JS/MasterExtended.js'}"></script>
{foreach from=$items item=entry}
{modslack Func=GetCategoriesNamesForCompany param1=$entry->id assign="catArray"}
{if "Members"|in_array:$catArray}
<li><a href="{$entry->detail_url}" >{$entry->company_name|escape:"htmlall"}</a></li>
{/if}
{/foreach}{modslack Func=GetCGBlogArticelUrl param1='22' param2='15' assign=aURL}{modslack Func=News_next_prev param1=$entry->postdate param2=$entry->category}
{if $news_next_url!=''}<h6 class="nextarrow"><a href="{$news_next_url}" title="{$news_next_text}" id="NextArt">Next Article</a></h6>{/if}
{if $news_prev_url!=''}<h6 class="prevarrow"><a href="{$news_prev_url}" title="{$news_prev_text}" id="PrevArt">Previous Article</a></h6>{/if}
Author: jeremyBass <jeremybass@cableone.net>
Website: CorbensProducts.com
Support more mods like this:
Author: jeremyBass <jeremybass@cableone.net>
Version: 1.0, 10.10.2009