PDA

View Full Version : Most Edited Templates


TWTCommish
02-26-2002, 10:00 PM
Alright, first off, this hack will probably only be of use to those who edit their templates with any kind of regularity. It's useful to me, so I figured it might be useful to others who like to tweak their templates and such constantly as well. :)

What's it do?
It tracks the number of times you've edited each of your templates. It also tracks the time of the last edit, and displays the top ten most edited templates on your CP home page. I find this saves a lot of time in template editing, as, otherwise, you've got to scroll to the bottom of the left-hand frame...besides; the templates you're always going back to will be the ones right there near the top anyway. :)

How do I install it?
Follow the instructions in the attached text file. It entails two very short queries to be run on your forums DB, And a couple of modifications in just two files. The whole thing should only take a few minutes.

Enjoy. :)

Xelation
02-27-2002, 08:54 PM
I didn't work, can I see a screen shot so I know what im looking for?..... I saved a template like 10 times and nothing

TWTCommish
02-27-2002, 09:08 PM
I had several people beta test this...if you followed all steps and got no errors or anything, your top ten templates ought to be right there on your main CP page -- scroll down to see it. :) Lemme see if I can attach a screenshot (might be too big)...

Xelation
02-27-2002, 09:10 PM
ah It worked I didn't notice that it was on the home of the cpanel.... great hack!

TWTCommish
02-27-2002, 09:12 PM
:laugh: Same thing happened with someone who tested it for me. It's easy to miss. :D Glad you like it.

Rose
02-27-2002, 09:22 PM
Another great one by TWT! :D I'm adding it to my main forum, now. :D

TWTCommish
02-27-2002, 09:25 PM
Wow! I have a fan! :: faints :: Oh, and call me Chris. :D

nafae
02-28-2002, 01:16 AM
Hmm I installed, does it not update itself after you install, and check for already-hacked templates? Because all of mine say "Never" when I have TONS of ahcked templates...

TWTCommish
02-28-2002, 01:23 AM
It only STARTS to track edits. vB doesn't track edits, so when you first install this, it can't possibly know how many times you've edited it already. :)

nafae
02-28-2002, 01:24 AM
alright just checking :)

SaintDog
02-28-2002, 03:52 AM
Just to clear things up for me, could you please inform me of this:

Does it count actual edits? Or Does it count the number of times you have clicked edit?

Just wondering, I could not tell from the SS, but I was curious.

Thanks,

SaintDog

TWTCommish
02-28-2002, 03:55 AM
Just times you hit edit...though I could modify it to track ACTUAL edits if you guys really want me to. :)

SaintDog
02-28-2002, 04:21 AM
I was just curious, you do not have to go through the trouble to make it like that unless you wish to, either way, it is a nice hack. :)

I was just wondering,

Thanks,

SaintDog

Lesane
02-28-2002, 09:36 AM
Great hack, works great here....for almost 2 weeks now ;) Well done :up:

Admin
02-28-2002, 10:07 AM
Nice concept. :)

mondaynightmike
02-28-2002, 11:12 AM
nice hack :)

TWTCommish
02-28-2002, 12:25 PM
Chen likes it!!! ::faint:: :laugh:

Admin
02-28-2002, 12:30 PM
Hehe. :) Yes I like it, especially the concept (haven't taken a look at the hack yet :)). Although I personally think it would be better and more useful in the Modify Templates page.

TWTCommish
02-28-2002, 12:34 PM
Well, that can certainly be arranged...though my original goal was to make templates more accessible. As it is I've messed around with the /admin/index.php file so as to have the Templates options placed near the top of the left-hand column...as I find it too cumbersome to have to scroll down to access them all the time. But yeah, for most that might work better...

slideboxer
02-28-2002, 12:38 PM
I find myself clicking edit to check the code, often. It's be nice to see this hack track the actual edits.

TWTCommish
02-28-2002, 01:06 PM
Oh, that's not what I mean. It doesn't track the times you view the template to edit it...just the number of times you go in and click the "Save" button.

Xelation
02-28-2002, 05:27 PM
yeah, I want it in the modify template section.... I find myslef clicking there all the time.... is there a way you can take it off the homepage of the cpanel and put it where I just said I wanted it?

TWTCommish
02-28-2002, 05:39 PM
Well, just take the block of code from the very last step in the instructions.txt file, remove it from the index.php file, and place it wherever you like in the template.php file -- if you want some help with that, just let me know where you want it to go, and I'll find out what line it should go after. :)

Xelation
02-28-2002, 05:55 PM
yeah I need some help, where should I put the script in the template.php

TWTCommish
02-28-2002, 05:59 PM
That depends on where you want the list of most edited templates to show up. :)

Xelation
02-28-2002, 06:04 PM
well I included and image.... the red line is where I want it.


http://www.xelation.com/personal/red.jpg

so can you help me? :D

TWTCommish
02-28-2002, 06:08 PM
Find this in template.php:

echo "<ul>";

if (!$expandset) {
$expandset=-1;
}Right before it, add the code from the last step...the code you added to index.php. I think that oughtta work.

Xelation
02-28-2002, 06:12 PM
ah, worked perfectly! Great Hack! this will be a real time saver. :D... i too find myself editing the same templates over and over again.

Boofo
07-14-2002, 11:18 AM
Fantastic hack, TWTCommish ! I must have missed this one. :) Thank you.

BigJohnson
07-15-2002, 08:56 AM
I love this feature. Do you think it can show the name of the TEMPLATE set for the edit. I think that would be useful also. Thanks.

Boofo
07-17-2002, 01:13 PM
Is there any way to make this so that the listing is in alphabetical order like the main listing? The ones I edit alot are really spread out and it would be easier to go right to the one in the list the same way you do in the main listing. :)

Sadie Frost
01-15-2004, 05:27 PM
I know this is an old hack, but I'd like to try and get it working for me in 2.34 - I can't seem to get it to keep track of the number of times edited - the edits and last edited fields always remain at 0.

This is the code I'm using for the update at the moment:

$DB_site->query("UPDATE template SET templatesetid=$templatesetid,title='$title',templa te='$template',edits = edits + 1,lastedit=time() WHERE templateid=$templateid");

Any suggestions? Thanks!

Boofo
01-15-2004, 07:07 PM
I know this is an old hack, but I'd like to try and get it working for me in 2.34 - I can't seem to get it to keep track of the number of times edited - the edits and last edited fields always remain at 0.

This is the code I'm using for the update at the moment:

$DB_site->query("UPDATE template SET templatesetid=$templatesetid,title='$title',templa te='$template',edits = edits + 1,lastedit=time() WHERE templateid=$templateid");

Any suggestions? Thanks!
Here's what I was using on vB2 and it worked great for me. It looks almost exactly the same but there is a slight difference. Try it and let me know if it helps.

$DB_site->query("UPDATE template SET templatesetid=$templatesetid,title='".addslashes("$title")."',template='".addslashes("$template")."',edits = edits + 1, lastedit='".time()."' WHERE templateid=$templateid");

Sadie Frost
01-15-2004, 09:58 PM
Hmm...doesn't seem to be working. Though somehow I have one template listed now correctly, but I can't get any others to work or that one to register more edits.

So I'm not sure if what I had before somehow worked briefly, or if when I changed to your code it briefly displayed correctly. But I can't replicate it using either my or your code. Weird!

Thanks for trying though!

Boofo
01-15-2004, 10:05 PM
If you want, I can send you the code I used for this. It is a little different but better than the original hack. I added some features that I use quite a bit. If you're interestd, pm me and I'll get it to you. ;)