Counter code in 2.0 after upgrade?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
accampbell
Regular
Posts: 133
Joined: Fri Jun 09, 2006 8:59 pm
Location: London, UK
Contact:

Counter code in 2.0 after upgrade?

Post by accampbell » Sun Feb 01, 2015 8:42 pm

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?
Anthony Campbell

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Counter code in 2.0 after upgrade?

Post by Timbalu » Sun Feb 01, 2015 8:58 pm

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
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

accampbell
Regular
Posts: 133
Joined: Fri Jun 09, 2006 8:59 pm
Location: London, UK
Contact:

Re: Counter code in 2.0 after upgrade?

Post by accampbell » Sun Feb 01, 2015 9:41 pm

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?
Anthony Campbell

User avatar
yellowled
Regular
Posts: 7021
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Counter code in 2.0 after upgrade?

Post by yellowled » Sun Feb 01, 2015 10:26 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

accampbell
Regular
Posts: 133
Joined: Fri Jun 09, 2006 8:59 pm
Location: London, UK
Contact:

Re: Counter code in 2.0 after upgrade?

Post by accampbell » Mon Feb 02, 2015 12:19 am

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.
Anthony Campbell

MarioH
Regular
Posts: 232
Joined: Mon Jul 20, 2009 10:53 pm
Contact:

Re: Counter code in 2.0 after upgrade?

Post by MarioH » Mon Feb 02, 2015 10:10 am

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

accampbell
Regular
Posts: 133
Joined: Fri Jun 09, 2006 8:59 pm
Location: London, UK
Contact:

Re: Counter code in 2.0 after upgrade?

Post by accampbell » Mon Feb 02, 2015 2:05 pm

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.
Anthony Campbell

User avatar
yellowled
Regular
Posts: 7021
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Counter code in 2.0 after upgrade?

Post by yellowled » Mon Feb 02, 2015 2:35 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

accampbell
Regular
Posts: 133
Joined: Fri Jun 09, 2006 8:59 pm
Location: London, UK
Contact:

Re: Counter code in 2.0 after upgrade?

Post by accampbell » Mon Feb 02, 2015 8:18 pm

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.
Anthony Campbell

Post Reply