I checked the 'config.php Reference' and it said there was a default value ($config['root_url'].'/assets') for assets_url.
I'm using cmsms 2.2.5
But when I use {assets_url} in my template it gives an error.
I have also tried with/without setting it in config.php and it gives an error both times.
Has anyone else experienced this?
assets_url is giving me an error
- PinkElephant
- Forum Members
- Posts: 169
- Joined: Fri Feb 06, 2009 2:08 pm
Re: assets_url is giving me an error
I guess the online reference is currently out of whack but it might be the code: 2.2.5 lib/classes/class.cms_config.php suggests that assets_dir and assets_path are the only two 'assets' values that are read.
Re: assets_url is giving me an error
There isn't a {assets_url} tag yet... The config setting is for core to know where the plugins (etc) folder is.
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: assets_url is giving me an error
Thanks for the info.
Re: assets_url is giving me an error
To get {assets_url}
just create a plugin in a new php file
name the file : 'function.assets_url.php'
put this file in directory : assets/plugins/
then you can use {assets_url} in your template
just create a plugin in a new php file
name the file : 'function.assets_url.php'
Code: Select all
<?php
function smarty_function_assets_url($params, &$smarty)
{
$config = CmsApp::get_instance()->GetConfig();
$out = $config['assets_url'] ? $config['assets_url'] : false;
if( ! $out )
{
/* get assets_dir */
$asset_dir = str_replace($config['root_path'],'',$config['assets_path']);
/* cleanup for localhost */
$asset_dir = str_replace('\\','/',$asset_dir);
$out = $config->smart_root_url().$asset_dir;
}
if( isset($params['assign']) )
{
$smarty->assign(trim($params['assign']),$out);
return;
}
return $out;
}
?>
then you can use {assets_url} in your template