Welcome to Geeklog Saturday, December 04 2021 @ 08:18 pm EST

Geeklog Forums

Use Sitename if no LOGO image

Page navigation


CDC

Anonymous
How can i modify all my theme header.thtml to if there is no public_html/images/LOGO.gif it will use the SITENAME:
<a href="{site_url}/index.php"><font size="6" color="#FF0000">{site_name}</font></a>
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
Hmm? The HTML you quoted should already do what you want ...

bye, Dirk
 Quote

CDC

Anonymous
No, The HTML i quoted is just using the SITE name.
I need some code to tell if there is no LOGO.gif it will use the SITENAME.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
PHP Formatted Code
<img src="{site_logo}" alt="{site_name}">
 
Plain ol' HTML ...

bye, Dirk
 Quote

CDC

Anonymous
Sorry for my definition.
But what i need is !

In the theme header of ex. WebBadAss_White you can specify if you will use a image or the site name as top logo...

Thats were i need some code to tell if there is no LOGO.gif it will use the SITENAME.
Rolling Eyes
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 20/10/03
Posts: 807
Use Dirk's HTML code above.
 Quote

CDC

Anonymous
I dont understand!
If there is no image called logo.gif in the images map, will the header use the site name as a top logo with this code...

&lt;img src=&quot;{site_logo}&quot; alt=&quot;{site_name}&quot;&gt;
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
Quote by CDC: If there is no image called logo.gif in the images map, will the header use the site name as a top logo with this code...

As I said above, this is just plain HTML. The text within the alt attribute will be displayed when the image is not there (or the user has decided to not load images).

Unless what you really want is something fancy (although I don't see the point), which would mean to use some PHP code (file_exists would come to mind) and an if statement ...

bye, Dirk
 Quote

CDC

Anonymous
Sorry but i cannot get it working.

This is the toptable in my header:
&lt;tr&gt;
&lt;td bgcolor=&quot;#FFFFFF&quot; class=&quot;outerborder&quot;&gt;
&lt;table width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot;&gt;
&lt;form action=&quot;{site_url}/search.php&quot; method=&quot;get&quot;&gt;
&lt;tr width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpading=&quot;0&quot;&gt;
&lt;td align=&quot;left&quot;&gt;
&lt;a href=&quot;{site_url}&quot;&gt;&lt;img src=&quot;{site_logo}&quot; alt=&quot;{site_name}&quot;&gt;&lt;/a&gt;

&lt;/td&gt;
With the logo.gif it is ok.
When i remove the logo.gif -take a look: http://www.internetsider.dk
 Quote

Status: offline

geKow

Forum User
Full Member
Registered: 12/01/03
Posts: 445
Hmmm.... I'm not sure what your point is. Do you mean you don't want an image as logo and a text instead, or do do you bother what happens when the image mysteriously disappears from your server?
Question
 Quote

CDC

Anonymous
My point is...
I have this complet GeekLog site with all the installations Forum, Chat, etc. and maybe 25 different theme.
When someone need at new site i can copy this complet GeekLog site to a new domain, and use the text or image for TopLogo and i am done.
 Quote

Status: offline

vegeta9870

Forum User
Newbie
Registered: 07/11/03
Posts: 8
PHP Formatted Code

if
file_exists({site_logo})
<a href="{site_url}/index.php"><img src={site_logo} alt={sitename}></a>
} else {
<center><font color="#whatever" size="whatever">{sitename}</center></font>

 


I believe thats it. If not i might be wrong on a small part.
If you wish to taste the ground feel free to attack me.
 Quote

CDC

Anonymous
No its not working.
i have tryed:
&lt;?php
if
file_exists({site_logo})
&lt;a href=&quot;{site_url}/index.php&quot;&gt;&lt;img src={site_logo} alt={sitename}&gt;&lt;/a&gt;
} else {
print '&lt;font size=&quot;6&quot; color=&quot;#BEA982&quot;&gt;{site_name}&lt;/font&gt;';
?&gt;
and:
&lt;?php
if
file_exists($site_logo) {
print &quot;&lt;a href=&quot;{$site_url}/index.php&quot;&gt;&lt;img src=&quot;{$site_logo}&quot; alt=&quot;{$sitename}&quot;&gt;&lt;/a&gt;&quot;;
} else {
print &quot;&lt;center&gt;&lt;font color=&quot;#FF0000&quot; size=&quot;6&quot;&gt;{$sitename}&lt;/center&gt;&lt;/font&gt;&quot;;
}
?&gt;
It gives me an error to!
 Quote

Status: offline

squatty

Forum User
Full Member
Registered: 21/01/02
Posts: 269
That code won't work.  You can't evaluate template variables inside a php statement. 

Try substituting {site_url} (and all other template variables) with the $_CONF global.  For example, $_CONF['site_url'].
In a world without walls and fences, who needs Windows and Gates?
 Quote

CDC

Anonymous
I am not sure about this:

&lt;?php
if
file_exists($_CONF['site_url']) {
print &quot;&lt;a href=&quot;{$_CONF['site_url']/index.php&quot;&gt;&lt;img src=&quot;{$site_logo}&quot; alt=&quot;{$sitename}&quot;&gt;&lt;/a&gt;&quot;;
} else {
print &quot;&lt;center&gt;&lt;font color=&quot;#FF0000&quot; size=&quot;6&quot;&gt;{$sitename}&lt;/center&gt;&lt;/font&gt;&quot;;
}
?&gt;
its not working...
 Quote

Status: offline

squatty

Forum User
Full Member
Registered: 21/01/02
Posts: 269
One more thing...there is no $_CONF['site_logo'] definition in config.php.  You need to use the full path of the image.

For example:

PHP Formatted Code

<?php
 $filename = '/path/to/logo.gif';
 if (file_exists($filename)) {
 print '<a href="'.$_CONF['site_url'].'/index.php"><img src="$filename" alt="'.$_CONF['site_name'].'"></a>';
 } else {
 print '<font size="6" color="#BEA982">'.$_CONF['site_name'].'</font>';
 }
 ?>

 

In a world without walls and fences, who needs Windows and Gates?
 Quote

CDC

Anonymous
This is how i did it:
&lt;?php
$filename = '{site_url}/images/logo.gif';
if (file_exists($filename)) {
print '&lt;a href=&quot;'.$_CONF['site_url'].'/index.php&quot;&gt;&lt;img src=&quot;{site_url}/images/logo.gif&quot; alt=&quot;'.$_CONF['site_name'].'&quot;&gt;&lt;/a&gt;';
} else {
print '&lt;font size=&quot;6&quot; color=&quot;#BEA982&quot;&gt;'.$_CONF['site_name'].'&lt;/font&gt;';
}
?&gt;
But no.
 Quote

CDC

Anonymous
Sorry this way, but no:

&lt;?php
$filename = '{site_url}/images/logo.gif';
if (file_exists($filename)) {
print '&lt;a href=&quot;'.$_CONF['site_url'].'/index.php&quot;&gt;&lt;img src=&quot;$filename&quot; alt=&quot;'.$_CONF['site_name'].'&quot;&gt;&lt;/a&gt;';
} else {
print '&lt;font size=&quot;6&quot; color=&quot;#BEA982&quot;&gt;'.$_CONF['site_name'].'&lt;/font&gt;';
}
?&gt;

http://www.internetsider.dk/internetsider/public_html/layout/CDCblues/header.thtml
 Quote

Status: offline

squatty

Forum User
Full Member
Registered: 21/01/02
Posts: 269

$filename = '{site_url}/images/logo.gif';

That won't work!!!!  I can't make it any clearer...you can't evaluate template variables inside of a php statement. 

You need to give the full system level path to the image.  For example:

$filename='/var/www/html/geeklog/public_html/layout/Yahoo/images/logo.gif';

You will need to customize the above for each theme you have on your Geeklog site.
In a world without walls and fences, who needs Windows and Gates?
 Quote

CDC

Anonymous
won't work...

&lt;?php
$filename = '/var/www/html/internetsider/public_html/layout/CDCblues/images/logo.gif';
if (file_exists($filename)) {
print '&lt;a href=&quot;'.$_CONF['site_url'].'/index.php&quot;&gt;&lt;img src=&quot;$filename&quot; alt=&quot;'.$_CONF['site_name'].'&quot;&gt;&lt;/a&gt;';
} else {
print '&lt;font size=&quot;6&quot; color=&quot;#BEA982&quot;&gt;'.$_CONF['site_name'].'&lt;/font&gt;';
}
?&gt;
I give up Oops!
 Quote

Page navigation

All times are EST. The time is now 08:18 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content