Logo link not working

Permalink
Here is my site:

http://www.prsseptic.com/

This is what I have for the link associated with the logo:

<a href="<?php echo DIR_REL ?>/">my logo here</a>

But it's going to:

http://www.prsseptic.com/themes/septic/index.php...

Can someone tell me how to fix this or what's the correct link to use?

redkite
 
jmonroe replied on at Permalink Reply
jmonroe
Why not try <a href="http://www.prsseptic.com">my logo</a>

If that doesn't work...then try this too:

<a href="<?php print DIR_REL; ?>/"><?php print SITE; ?>my logo</a>

Hope this helps.
Steevb replied on at Permalink Best Answer Reply
Steevb
Do you have this in your header.php:
<h1 id="logo"><!--
--><a href="<?php   echo DIR_REL?>/"><?php   
$block = Block::getByName('My_Site_Name');  
if( $block && $block->bID ) $block->display();   
else echo SITE;?></a><!--
--></h1>


Also you have a few errors in your code.

Body tag twice, stray p tag, nested header tags and theme template is giving a character set which you don't need because C5 does it for you.

Try cleaning up your code.
mhawke replied on at Permalink Reply
mhawke
How would cleaning up the code make the header link use the right path?
mhawke replied on at Permalink Reply
mhawke
It doesn't appear you have set a DIR_REL variable in your site.php file.

Try this simple solution instead:

<a href="<?php print BASE_URL; ?>">my logo</a>


I tested it and it works on my site.
Steevb replied on at Permalink Reply
Steevb
Just thought I'd mention the code errors, is all?
redkite replied on at Permalink Reply
redkite
Thanks so much. This was my first C5 attempt, and I followed a tutorial that was obviously missing some things.

Cleaning up the code validation errors did the trick; I also used this in header.php and it's working well:

<h1 id="logo"><a href="<?php echo DIR_REL?>/"><img src="<?php echo $this->getThemePath()?>/images/septic-logo.png" width="400" height="123" alt="Septic Pumping and Cleaning logo" /></a></h1>
mhawke replied on at Permalink Reply
mhawke
I'm really glad that you got it working but if you look at the 'View Source' of your page, you will see that the href for your logo is '/' indicating that your aren't actually injecting your proper URL in there. The 'DIR_REL' constant is used when you have your concrete5 installed in a DIRectory RELative to your root. For example, if you were running concrete5 from "http://www.prsseptic.com/C5/index.php" then you would put

define('DIR_REL','/C5');


in your config/site.php file.

If you look in your root/config/site.php file, you will probably see that you have defined BASE_URL as "http://www.prsseptic.com" so I would recommend putting BASE_URL in place of DIR_REL in your logo link.

I know it's working and I'm not trying to be picky but since you are new to C5, I thought it was important to explain the differences between the constants being used by C5 to prevent any confusion in the future. The only reason your solution is working now is because you left a backslash in there. If you had left the backslash out, there would be no href at all and it still would not work.
redkite replied on at Permalink Reply
redkite
Thanks very much - I want to make sure I understand this so I can do it correctly on the next project, so your pickiness is appreciated. I'll take care of this Monday.
redkite replied on at Permalink Reply
redkite
I don't have BASE_URL defined in site.php at all, all that's in there are the DB settings, the password salt, and the update directory name.

What do I need to add?
mhawke replied on at Permalink Reply
mhawke
If it's missing from site.php then C5 sets the BASE_URL in root/concrete/config/base.php but recommends it be added to site.php:

Relevant snippet from base.php:

# These items should be set by site.php in config/ but if they're not that means we're installing and we need something there
if (!defined('BASE_URL')) { 
   if(isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) {
      define('BASE_URL', 'https://' . $_SERVER['HTTP_HOST']);
   } else {
      define('BASE_URL', 'http://' . $_SERVER['HTTP_HOST']);
   }
}


I would put it in just to be sure you don't have to troubleshoot some goofy error down the road.

The proper format is:

define('BASE_URL','http://www.prsseptic.com');
redkite replied on at Permalink Reply
redkite
Done - thanks for all your help! Next time I'll know what I'm doing a little better.