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() { ?>

Ever just had a need for a off function...

... 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.

How do I use this tag?

Functions:

fileTime($path) -- returns file creation time of a file for caching controll

MOD - Company Directy

-- GetCategoriesNamesForCompany($params1=$id) -- returns an array of the Categories of the company id

MOD - Products

-- GetCategoryName($params1=$id) -- returns the name of the Category of the Category id



Params



Examples:



Author: jeremyBass <jeremybass@cableone.net>
Website: CorbensProducts.com
Support more mods like this:


Version: 1.0, 11.19.2009

Author: jeremyBass <jeremybass@cableone.net>

Version: 1.0, 10.10.2009