Home » Technology » Lots of site updates

A tidy up

First task on the list was a general tidy up of the structure - removing old chunks used for testing, renaming chunks into more meaningful names, tidying up some CSS and stuff like that. Pretty much all done, except for the templates - need to finish those off in the next couple of days

I also had some odd behaviours which needed fixing - colorbox not working when using opacity settings in FF, the blogs date archives not working (categories were OK, but not the dates) in anything other than the Astronomy blog. I fixed the colorbox issue by removing opacity for now - at least until I can either figure out the problem, or put something else in its place

The date issue with the blogs had me going for ages! I couldn't figure out why one blog worked, but the other two didn't. Everything was essentially the same across all three, with the parents just being changed appropriately, but the Technology and Leisure just would not work! I could remove the date parameters from the address bar, and that would give me the whole list, so I knew the basic call was OK. I then found a system setting for Archivist that had the following '64:arc_' in it. A light bulb went off! 64 is the ID for the Astronomy getArchives and I figured that the 'arc_' bit was the default filter used (and in fact it is). So I edited this value, and added the other two pages in and all is working as expected now!

Template Conditional HTML

So, the next task was to implement some conditional HTML into the template. The template output the *longtitle and *content placeholders and sidebar tv into a 'content' div. Fairly standard, no problem there. But what I wanted was to set a TV on the resource to a) show the *longtitle and b) show the sidebar - and if no sidebar, then use a different id for the content, to make use of the full width of the page.

I started playing with the 'if' snippet, but realised that it does not support nesting, so I had to take the leap and write my own first real bit of PHP. I had done some simple one-liners before to get current month, for example, but this would be my first bit with a condition in - and a nested one at that! Luckily PHP seems very straight forward, so it didn't take too long to do - and it works perfectly!

A snippet call within a chunk call!

Next. I am starting on a series of pages called 'At the Zenith' - where I will examine a constellation that appears straight up (at the zenith!) and look at the mythology and objects. Good for my knowledge and learning as much as anything else!

I wanted to be able to write the pages well in advance and have the system dynamically change the content according to the month.

In order to do this, I needed a way to get the current month - easy enough - and then use that to load the correct page.

The solution was very much a guess - I wondered if I could make a call to a snippet (to get the current month) inside the call to a chunk - and indeed, you can!

The declaration is: [[$[[GetMonth]]-zenith]] where, GetMonth is the snippet to return the month number, and this is appended (pre-pended?) to the front of '-zenith' to call the correct chunk. So November would be 11-zenith, December would be 12-zenith and so on

Just goes to show, if you're not sure - try!!

Galleries

Finally, an update on the Gallery series I started some time ago. I have created a demo site and am re-writing the articles right from the beginning, so hopefully someone picking up Gallery for the first time will be able to get up and running quickly.

Hopefully, this will be in a publishable state very soon!