Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / where to add a new 'define' - Text for the Logo?

where to add a new 'define' - Text for the Logo?

Locked

Views: 2,639

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
20 May 2007, 2:12 PM
#1
miriam_t avatar

miriam_t

New Zenner

Join Date:
May 2007
Posts:
38
Plugin Contributions:
0

where to add a new 'define' - Text for the Logo?

Sorry for asking, but I haven't found anything on this so far...

I would like to add a special css-class to my header logo. So as recommended I copied the header.php from /includes/languages/english/classic to my newly created override-file in /includes/languages/english/mytemplate and added a new define like this

define('HEADER_LOGO_IMAGE', 'RR-Logo.jpg');
define('HEADER_LOGO_CLASS', ' class="logo"');

assuming that ZC will add that to the tpl-header.php like the other ones:

<?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT, HEADER_LOGO_CLASS). '</a>'; ?>

But this doesn't do the trick?

What do I have to change to get the additional class-information into my <img>-tag?

Thanks in advance!

Miriam

20 May 2007, 3:28 PM
#2
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,608
Plugin Contributions:
0

Re: where to add a new 'define' - Text for the Logo?

What are you trying to do with the logo using the CSS?

20 May 2007, 3:53 PM
#3
miriam_t avatar

miriam_t

New Zenner

Join Date:
May 2007
Posts:
38
Plugin Contributions:
0

Re: where to add a new 'define' - Text for the Logo?

I've added some margin/padding to the image, that's all. I created a "sidebar" which contains The Logo, some text and the ZC left-sideboxes, and everything has its special positioning, so there is a class for the image to manage the exact position in relation with the other stuff...

But to use these define-texts would be usefull for other things too...

Want do you think about it?

Regards, Miriam

20 May 2007, 4:06 PM
#4
miriam_t avatar

miriam_t

New Zenner

Join Date:
May 2007
Posts:
38
Plugin Contributions:
0

Re: where to add a new 'define' - Text for the Logo?

What (sic!) do you think...

nasty typo

I looked for the zen_image and found its occurence in various files. Am I right that my css-class has to be assigned as an additional variable in the general function like the $alt for alt-text and $width for the image-width?

20 May 2007, 4:18 PM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: where to add a new 'define' - Text for the Logo?

The easiest way to handle this would be to wrap the link in a <span class="sidebarLogo"> </span>.
You're adding new code anyway; the span would be simple and effective... of course, getting proficient at using the specialized zen functions is a good thing.

See any interior page of my site for another example of sidebar logo.

20 May 2007, 4:28 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: where to add a new 'define' - Text for the Logo?

Another point - if you are using this inside a div (say id="sideLogo") with text, even links, but no other images, you can style

#sideLogo a img {}

to affect only that image within the div.
No further tags required.

20 May 2007, 4:43 PM
#7
miriam_t avatar

miriam_t

New Zenner

Join Date:
May 2007
Posts:
38
Plugin Contributions:
0

Re: where to add a new 'define' - Text for the Logo?

So sorry, but I thought over it already... You seem to solve this always by editing the CSS, do you? But there will be some more images in that place...

Of course I could add a class to those images, in order to keep them in place, despite of the text-align of the complete sidebar...

But it would be correct to assign the class to the logo image, which has to stand out of the rest...

And it should not be too hard to achieve that little class-addition? Meanwhile I found in Smarty and image function something like extra parameters? Adding the class in the way I did above results in either text (<img>class="logo"</a>) oder in adding the class="logo" to the Alt_Text of the image itself. I did not expect this to be so difficult...

Best regards, Miriam

20 May 2007, 5:28 PM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: where to add a new 'define' - Text for the Logo?

I was looking at zen_image just the other day, and it has already a place for things like class to be added ($parameters), after width and height.

function zen_image($src, $alt = '', $width = '', $height = '', $parameters = '') {

I believe it needs these in the correct order to recognize what each value is supposed to represent, so to get $parameters you have to get past $width and $height. Adding extra commas may do it since there are default values.

zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT,,, HEADER_LOGO_CLASS).

20 May 2007, 6:13 PM
#9
miriam_t avatar

miriam_t

New Zenner

Join Date:
May 2007
Posts:
38
Plugin Contributions:
0

Re: where to add a new 'define' - Text for the Logo?

YES!

Adding commas did not work, throwed php-error instead, but inserting all missing vars made it:

<?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE,HEADER_ALT_TEXT,HEADER_LOGO_WIDTH, HEADER_LOGO_HEIGHT,HEADER_LOGO_CLASS). '</a>'; ?>

results in:

<!--bof-branding display-->
    <a href="http://localhost/zen/"><img src="includes/templates/RR-Template/images/RR-Logo.jpg" alt="Rabe & Rose" 
title=" Rabe & Rose " 
width="164px" height="149px" class="logo" /></a> 

Hah! That's nice! Thank you very much!
:clap:

Regards, Miriam

This also means, that you can add anything you like to the image-tag... I will check where $parameter is sitting as well to extend existing template issues - That's probably worth mentioning in the FAQ section, gjh42!

20 May 2007, 6:45 PM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: where to add a new 'define' - Text for the Logo?

Hmm... so it needs a value for each piece, not just a comma to skip it.
If you don't want to assign a constant to the width & height but let the image determine it, would it work to put blanks in? ```php
zen_image($src, $alt, ' ', ' ', $parameters) {

21 May 2007, 4:00 AM
#11
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: where to add a new 'define' - Text for the Logo?

A good way with zen_image would be like this under the admin:

zen_image(IMAGE_FOLDER . 'image.gif', ALT_TEXT);

Icons under the store front:

zen_image($template->get_template_dir('icon.gif', DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . ICON_IMAGE_NAME, ICON_IMAGE_ALT_NAME);

Images with width and heights sizes:

zen_image(DIR_WS_IMAGES . 'image_name.gif', '', 'width size', 'height size');

:wink2:

21 May 2007, 6:34 AM
#12
miriam_t avatar

miriam_t

New Zenner

Join Date:
May 2007
Posts:
38
Plugin Contributions:
0

Re: where to add a new 'define' - Text for the Logo?

Yes, adding some comma with single quoted whitespace like this

<?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE,HEADER_ALT_TEXT,' ',' ',HEADER_LOGO_CLASS). '</a>'; ?>
```in tpl_header.php is working also. But I think it is tidy, to set image-sizes, so I don't mind doing that.

Once again: thank you... 

This $parameter could also be useful to stick in some ```html
style="whatever...  border:something or so"
``` just as one needs in special occasions for a single image.

Regards, Miriam