Building theme "how do I" questions

RwD
RwD's picture

Joined: 2005-01-09
Posts: 383
Posted: Fri, 2005-09-09 07:17

Yesterday evening I started with a blank template and began making my own theme, slowly adding the parts I need, where I need them. Mostly I look at the smarty code from other people to understand how to get the parts I want. (Never used smarty before because it isn't really a template engine)

There are also things that I have to make myself as nobody made them this far and I am confident I will succeed with the smarty based things on my own (or else I'll ask) but there are so far two gallery questions I did not find the answer to...

1. Can I force every sidbar to have header-content?
I can of course give every sidebar a header and possibly just display it empty but I would much rather have sensible header text in every block like the random image block does have already.
--

2. How can I set a header for the albums main block?
Somewhat like the previous question except now for the main block that displays the albums that are available in the current album.
I would need a fixed header displayed above the subalbums section like "albums" on the main page and "subalbums" in all other albums that habe subalbums.
Right now gallery is not giving me any header here at all, is it possible for gallery to return header code as well?

Alternatively, if gallery does not output header code, how do I put in a fixed and localized header text inside my templates?
--

That's it for now, I'm sure more questions will arise.

By the way, I did find the codex.gallery2.org page so I did read documentation but I didn't find my answers in there.

ps, I am building this theme in at least four steps:
1. Making it the way I need it,
2. Change the style and make it available here,
3. Make it work at least reasonably with all the modules that come with gallery,
4. Adding settings to the theme.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-09-09 08:58

1./
there is only 1 sidebar per page. do you mean every sidebar block?
Sidebar blocks are not different from any other block. They are just blocks that happen to be added to the sidebar block list. They could also be added to the album or photo page block list.

to you question: i guess you're asking about html <head> content, right? "header-content" is ambiguous, because you could mean just a general site header, which would be <body> content, just at the top of each page, or you could mean http header too :)

each block can have a Preloaded <head> content, yes.

2./
is this again about <head>? or about some html content right after <body>?

and to your theme step by step guide, you could also add:
5. fix browser specific issues (which isn't a fun part of course :/ )

 
RwD
RwD's picture

Joined: 2005-01-09
Posts: 383
Posted: Fri, 2005-09-09 09:04

at point 1.
I was talking about the headers which for a sidebar block would be <h3>
So each sidebar block I want to have a header (h3 node) with sensible content instead of some having it and others don't.
example: In the sidebar the random images block has a (<h3>) header and the search block doesn't

at point 2.
Again I am talking about the content in the layout, I want a header to display above the section that displays the subalbums.

at the step by step guide:
There will be no point 5 to fix browser specific issues, I always check it works in FireFox then IE before I call a part I made finished so I am doing it as I go along already ;)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-09-09 09:16

1./
no, not all blocks have a <h3> element. not even optional. you'd have to override the SearchBlock.tpl template with a local/ override. Or you have to add the <h3> element in your sidebar.tpl file.

2./
and adding it at the top of album.tpl isn't "above the section that displays the subalbums" ?
Else you need to add it in theme.tpl.

ps: then add as step 5. cross platform fun ;)
sure FF and IE on WinXP covers 95% of your users or so, but there are still a few other browsers on other platforms (OSX, linux) and on WinXP, there's also opera and some others. it's a never ending story...

 
RwD
RwD's picture

Joined: 2005-01-09
Posts: 383
Posted: Fri, 2005-09-09 09:34

1./
I think you should add the possibility for blocks to be forced to show a header element by the layout so layouts can buld consistent looking output. I think Bharat mentioned in an email about the theme refactor that one should be able to pull several different forms of code from a block so one could decide which elements to use no matter if the module creator wants to add more or whatever.

A header could be an easy thing to require for a block and make it the block author able to not display it. But in the end then the theme designer should be able to override the descision like I can now choose to not display the random image's block header using css. (But I cannot let a header appear with css that is not there, with gallery code I might, but this should be an option then)

Right now it is impossible for me to show a search block, a random image block and an item option block with a consistent look because I want all three of them to have a header to tell the purpose of the block but only one block can get it.

2./
I can easily insert html code there that does the trick. But the question is; can gallery output a header there optional.

If gallery cannot, then how do I put in a localized string so it will display a different text for different languages?

ps,
Making everybody happy is a very demanding task that I will never succeed in performing. So I choose to stick to standards, check FF/IE and cross my fingers opera implements the standards correctly.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-09-09 10:30

2./
so this is actually about the album name / title?
e.g. {$item.title} ?
or is it about the string "Album" or "Subalbum" ? then you need to put this string into {g->text text="Album"} or something like that.
once you're done with your theme, you need to run the tool to extract all translatable strings from your theme (lib/tools/ ...) which will create the strings.raw file and then you need to translate it to other languages with a tool like KBabel (or hope that the G2 translators will translate your theme too)..

 
RwD
RwD's picture

Joined: 2005-01-09
Posts: 383
Posted: Fri, 2005-09-09 11:31

2./
It is about the string Album or Subalbum (or anything similar)

Do you perhaps have any hints on how to do the extract translatable strings thing? Is that server side? Looking at the files and extentions in there it doesn't ring any bells on how to proceed...

(btw, I am on a windowsXP machine (but the server is linux running apache if required))

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-09-09 11:42

for g2 development, we hightly recommend a linux box. you'll need some linux (*bsd, unix, ..) command line tools.
on windows xp, you can install cygwin, but i don't know if all tools work there.

so, you don't need to use all g2 development tools, you don't need to run gmake (module developers need that) and you don't need saxon / rxp.
you just need to execute the extract tool which is written in .php, so you can run it on the webserver afaik. but i have never touched this part of g2. you might have to run it from the command line (CLI php).
maybe mindless can help you there.