![]() |
Better "Preview" for templates in the CP
This is a very quick hack that enhaces the "Preview" feature in the Template Editor. Currently I find the preview to be useless, I can also see funky colors and odd tables.
With this hack, you will get a slightly better idea of how the template will really look like, because all the {replacement} variables will be replaced with their real value. If you have Mutt's "Advanced Template Editor" hack installed, please follow the directions in this post: https://vborg.vbsupport.ru/showthrea...&postid=253878 Thanks Mutt! In template.php replace: PHP Code:
PHP Code:
Code:
$replacementsetid = 1; ### Change me to use a different replacement set! |
And here is a screen shot for the imagination challenged...
|
Here's how it looks currently, without the hack. Ugly right?
|
Until now I'd never even realised that this 'Preview' feature was there, I must be a little short sighted! Nice work FireFly! Running on 2.2.5 well. :D
|
very nice addition and works perfectly here..
|
BTW, there is a small bug when you Preview empty templates. The Javascript function I added (found it by Google ;)) doesn't support empty strings, so the page will just hang. Then again you shouldn't have any empty templates, and if you had you wouldn't want to preview them, so...
|
Very Nice, works great for me.
|
nice hack, I'll have to install it when I get home ;)
|
omg u read my mind firefly... i was going to request this 2nite... how about being able to allow images in the preview??
also my replacement set doesn't seem to be working on the previews...??? any ideas?? Thanks In Advance |
Just a word of caution...if your using Mutt's Template Editor this will not work correctly....
|
Yeah, it would help me alot to have a perfect Preview, with all the variables and images showing
|
Wow, I didnt even know there was a preview button. Would there any way to display images or maybe even display the variables?
Thanks again Chen. |
installed, it took 2 minutes and work great, I love it, very smooth
|
Quote:
only temporarily (just for previews)...if you're asking how to do it without then I'm not too sure... as for displaying the variables, that would be cool |
Quote:
|
Big time excitement here. I never use preview because its pointless. But this creates a use finally! Thanks
|
Many thanks
I use a vb 2.2.1 and have noticed the following error. Unfortunately, it works this one look for badge in the template no more. I hope somebody can help me. Please, my bad one excuses English. |
want to make it so it also parses the $variables ?
|
Making it eval() the $variables would be a much more complicated, because you need to set an "example url" for each template, then call it with the temp template. It's not very simple, trust me.
I'll try to fix the images not showing in a minute... |
Ok, just released a new version and now it also shows you the images.
To upgrade, replace this: PHP Code:
PHP Code:
|
Ahhh, life is so much easier now. :) Thanks, Firefly! (Now I can see all of my mistakes as I do them. :))
|
Is it just me, or is the PHP code box not clickable now here? I tried it on my sire and I can still click them. But I can't seem to do it here now.
|
really, really, nice ;)
|
I removed it Boofo, it became annoying when you just want to copy a small portion of the code.
|
Did it add any extra load to the site? The reason I am asking is I just got it set up on my site and think it is the greatest thing to come along on any system. Do you still have it for the larger code or is it gone altogether? Can it be set up for a certain length of code or higher?
Quote:
|
It doesn't add any load, no.
|
I was just curious. :) What about being able to set it up for a certain size of code or larger? Can that be done?
|
Not sure what you mean, but can you please ask this in the hack's thread? Thanks.
|
np, sorry.
|
Good work FireFly!
|
NICE HACK!! squawell like this one too...thankz..FireFly..:D:D:D
|
hmmm, I installed the first part yesterday... and today I did the upgrade for the images... everything is fine except the images still dont show up... you know what could be wrong?......
update, figured out my problem... your code says to search for the word { imagesfolder } (w/o the spaces) erm, I dont use that, I just do images/yaddayaddayadda.gif oh well, never the less its a good hack :) |
Nice job Firefly
When I first added the preview button, I really wanted it to replace the vars but counldn't think of any easy way to do it. I know it was ugly, but I found it better than nothing. It was just some code I found at a javscript site. this is 100% better. a huge improvement. I read that it didn't work with the template editor. i'll figure it out and see where the conflict is. thanks again. very cool |
Quote:
|
Fireflys hack is a huge improvement. everyone should install it. Great job!!
I was able to get it working with my advanced template editor. the changes are minimal. function dotemplatejavascript from the advanced template editor is slightly different than the original one. here is the slightly modified version that works with it. THIS IS ONLY FOR PEOPLE USING THE ADVANCED TEMPLATE EDITOR!!!!! here is the code to look for PHP Code:
PHP Code:
|
Well done, Firefly! :)
|
Thanks Mutt! I edited your post BTW, you had replacement in the code. :)
|
Quote:
|
Whenever I try to preview a template now, I get a Runtime Error. The error says "Line 324" "Object expected". The file is says it is in is the template.php. Here is the code and the line it stops at is the Preview line.
Code:
<input name='string' type='text' accesskey='t' size=20 onChange='n=0;'> |
Thanks Firefly!!
And yet another usefull hack that was very easy to install!! /me bows down!! |
All times are GMT. The time now is 01:34 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|