Jump to content
mischka

skinurl function to shorten code

Recommended Posts

Hello

I was digging around in phpvms today and came across the functions for url, actionurl, adminurl etc. So I started thinking, it'd be really handy to have something similar for the skin url.

So instead of 

href="<?php echo SITE_URL?>/lib/skins/crystal/styles.css"

you would go

href="<?php echo url('styles.css'); ?>"

that's much shorter, and also if for some reason you'd want to change the folder of your skin you don't need to recode everything. 

so I wrote that little function, here it is: 

function skinurl($path="")
{
	if($path[0] != '/')
		$path='/'.$path;
	
	return SITE_URL.'/lib/skins/'.CURRENT_SKIN.$path;
}

all you need to do is paste it into your /core/bootstrap.inc.php and you're done!

maybe this can be included in phpvms core?  

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×