Page 1 of 1

Counter code in 2.0 after upgrade?

Posted: Sun Feb 01, 2015 7:42 pm
by accampbell
I just upgraded to the new version (2.0). Up to now I've put my counter code in index.tpl in the front end I use, which is Party Brown. This no longer seems to be possible. Must I use a different front end which contains index.tpl or is there somewhere else to put the code?

Re: Counter code in 2.0 after upgrade?

Posted: Sun Feb 01, 2015 7:58 pm
by Timbalu
What do you mean by "no longer seems to be possible"? [It should!]
What exactly are you trying to do?
Maybe you just need to know this? http://www.smarty.net/forums/viewtopic.php?t=4501

Re: Counter code in 2.0 after upgrade?

Posted: Sun Feb 01, 2015 8:41 pm
by accampbell
I need to insert the code supplied by my counter. This is a short script with some java. I used to put it in index.tpl for Party Brown.

Now, ../templates/party-brown has only 2 or 3 files and no index.tpl. The other frontends I've looked at. e.g default, do have lots of files including index.tpl.

Could the code go elsewhere, e.g. in serendipity/index.php?

Re: Counter code in 2.0 after upgrade?

Posted: Sun Feb 01, 2015 9:26 pm
by yellowled
accampbell wrote:I need to insert the code supplied by my counter. This is a short script with some java.
Javascript. Java is a different language.
accampbell wrote:I used to put it in index.tpl for Party Brown.
From what I can tell, party-brown never had an index.tpl file. The theme is very old (last edited 2011, probably when we switched the repository to GitHub), a lot of these old theme do not have an index.tpl. According to the git repository's history, party-brown's files have not been changed since moving the files from SF to GitHub.

(Also, side note: whenever you make changes to files that are part of s9y, be it the core or Spartacus, please make sure you keep backups.)

You should be able to just copy /templates/default/index.tpl to /templates/party-brown/index.tpl and make your changes there (which will in fact be safe in case of an update because the original does not have an index.tpl). I assume this was what you did before, although that would not explain why the file would be gone.

YL

Re: Counter code in 2.0 after upgrade?

Posted: Sun Feb 01, 2015 11:19 pm
by accampbell
Yes, I thought the fact that PB is old might be the problem, although I'm sure it did have index.tpl previously. Anyway, I'll experiment on the lines you suggest tomorrow and report back. Many thanks.

Re: Counter code in 2.0 after upgrade?

Posted: Mon Feb 02, 2015 9:10 am
by MarioH
Hi,

there are also some Plugins to put additional code to your blog:

serendipity_event_head_nugget
serendipity_event_page_nugget
serendipity_plugin_html_nugget

Maybe this works for you.

Regards
Mario

Re: Counter code in 2.0 after upgrade?

Posted: Mon Feb 02, 2015 1:05 pm
by accampbell
Thanks to everyone for replies - much appreciated.

The nugget solution didn't work, presumably because this is not html code.

I also failed with PB, and in fact that front end no longer works at all -the colours and layout are all wrong. So now I'm using 2k11 and inserting the code in index.tpl, which seems to be working.

I have a different problem with the new backend, but I'll use a new thread for that.

Re: Counter code in 2.0 after upgrade?

Posted: Mon Feb 02, 2015 1:35 pm
by yellowled
accampbell wrote:The nugget solution didn't work, presumably because this is not html code.
The HTML nugget can hold Javascript code as well, but you might have to “mask” certain characters of the JS code because they are special characters in HTML. However, the same would be true in index.tpl …

By the way, make sure that you keep a backup of your modified index.tpl – 2k11 is part of the core, so this file will be overwritten by every s9y update! (Which is why the HTML nugget would be a better solution.)
accampbell wrote:I also failed with PB, and in fact that front end no longer works at all -the colours and layout are all wrong.
There is no reason why a theme should no longer work in 2.0 (unless we made some huge mistake that no one noticed so far, which, you know, is possible). Are you sure you were using party-brown before? Last time I checked your blog (yesterday), it was running one of the andreas themes …

YL

Re: Counter code in 2.0 after upgrade?

Posted: Mon Feb 02, 2015 7:18 pm
by accampbell
I'll have another go at the nugget method later, when my wrist has healed. But for the moment I think I'd better quit while I'm ahead ...

Yes, I was using party-brown previously but I experimented with others after the upgrade.