assets_url is giving me an error

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am
Location: Sydney Australia

assets_url is giving me an error

Post by Simon66 »

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?
User avatar
PinkElephant
Forum Members
Forum Members
Posts: 169
Joined: Fri Feb 06, 2009 2:08 pm

Re: assets_url is giving me an error

Post by PinkElephant »

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.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: assets_url is giving me an error

Post by Rolf »

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
- + - + - + - + - + - + -
Image
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am
Location: Sydney Australia

Re: assets_url is giving me an error

Post by Simon66 »

Thanks for the info.
aviapic

Re: assets_url is giving me an error

Post by aviapic »

To get {assets_url}

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;
}
?>
put this file in directory : assets/plugins/

then you can use {assets_url} in your template
Post Reply

Return to “CMSMS Core”