Skip to content

Instantly share code, notes, and snippets.

@pixmonkey
pixmonkey / Redirect to URL
Created January 6, 2014 03:30
Redirect to URL in Concrete5. This code goes into the theme header. New page attribute needs to be created called "redirect_to_url".
<?php
if ($redirectURL = $c->getCollectionAttributeValue('redirect_to_url')) {
if ($redirectURL != '') {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: " . $redirectURL );
}
}
?>
@pixmonkey
pixmonkey / Login:Logout button to add to autonav
Created January 6, 2014 03:28
Login:Logout button to add to autonav in Concrete5. This gets added just before the end of the script above the last code block. Make sure you duplicate the autonav>view.php.
$u = new User();
if($u->isLoggedIn()){
echo('<li><a href="' . $this->url('/login/logout') . '">Log Out</a>');
}else{
echo('<li><a href="' . $this->url('/login') . '">Log In</a>');
}