Is there an example of EE code if creating a link to the control panel to put in a template? or do you just have to hardcode it?
so if logged in - show CP Home link.
Can only find one that links to profiles, which I don’t use.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
February 02, 2012 11:01am
Subscribe [4]#1 / Feb 02, 2012 11:01am
Is there an example of EE code if creating a link to the control panel to put in a template? or do you just have to hardcode it?
so if logged in - show CP Home link.
Can only find one that links to profiles, which I don’t use.
#2 / Feb 03, 2012 5:27pm
Hi stevo_s,
There isn’t a pre-set variable for it, but you could assign the link to a global variable and then call that in your template based on member level. If you are using admin.php you can use this in your template as well:
{site_url}admin.php
Cheers,
#3 / Feb 03, 2012 5:48pm
If you’re using it in multiple contexts I would set it as a snippet which is just :-
<a href="http://{site_url}admin.php">Control Panel</a>
You could alternatively make it a Global Variable of:-
<a href="/admin.php">Control Panel</a>
But if you were to implement the GV across 5 templates and then realise you need to use EE code it’d be a mess, so may as well jump right into Snippets for this. In addition it only works in a neat way if you’re admin is on the top level of the domain.
Of course if you’re only using the link in a global footer template, you may stick it directly into the template.
#4 / Feb 04, 2012 6:11am
Great thanks.
#5 / Feb 04, 2012 7:24am
BTW I created another topic on this, but is it secure to allow access to the admin login url anyway?
And is it best to change it to admin673.php or something?
#6 / Feb 04, 2012 10:10am
#7 / Feb 04, 2012 12:07pm
Thanks Boyink! hadn’t seen that one before.
#8 / Feb 04, 2012 12:28pm
Hi stevo_s,
Thanks to Mike!
It looks like you are all sorted now.
Thanks you for using the forums!
Cheers,