Jump to content

skinurl function to shorten code


mischka

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?  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...