vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Return to Edit Template page after saving (https://vborg.vbsupport.ru/showthread.php?t=28625)

Admin 09-21-2001 10:00 PM

This is far from being a hack, so I figured I should post it here.
Probably be moved though... :)

Anyway, this adds an option to the Edit Template page for returning to the same page or not.
If you select yes, then the template will be saved and you will be sent back to the editing page.
If you select no (default), then you will be sent to the main template list.

I wanted this cuss I sometimes I just edit a template over and over and over again, and loading the list again is quite a pain you-know-where. ;)

Hopefully others will also find this helpful.


All changes are done to template.php (admin folder)!

Find this code:
PHP Code:

  makehiddencode("group""$group"); 

(second time it appears, not first time!)
and right above add this:
PHP Code:

  makeyesnocode("Return to this page?","return",0); 

Now replace this:
PHP Code:

  echo "<p>Done!</p>";
  
$action="modify";
  
$expandset=$templatesetid

with
PHP Code:

  echo "<p>Done!</p>";
  if (
$return) {
    
$action="edit";
  } else {
    
$action="modify";
    
$expandset=$templatesetid;
  } 

And last but not least move this block:
PHP Code:

// ###################### Start do update #######################
if ($HTTP_POST_VARS['action']=="doupdate") {
  
// a few lines of code here


a few lines up, namely right before this:
PHP Code:

// ###################### Start edit #######################
if ($action=="edit") { 

And that's it.
If you want the default selection to be yes (not recommended - for obvious reasons), change the 0 to 1:
Code:

  makeyesnocode("Return to this page?","return",0);
That's it, hope you enjoy this. :)

Please note that this is only and only for edited template.
For original templates the option will not show up, because well, it's bit more complex. :p

I added a screen shot if you still don't get this. ;)

eva2000 09-22-2001 12:02 PM

i like this one :D

Mike Gaidin 09-22-2001 12:10 PM

Me too. :D Good one!

Goldfinger 09-22-2001 12:12 PM

Again another great hack by FireFly :D.

Thomas P 09-22-2001 03:29 PM

Veeery helpful and -although never spoken out ;)- long awaited :D
Pleeeease make it a standard feature, vb folks :)
Thanks FireHacker :p
-Tom

FWC 09-22-2001 06:55 PM

Very nice, Firefly! Thank you. :D

Alien 09-23-2001 07:56 AM

Very helpful, thanks bunches!

:D

Admin 09-23-2001 09:09 AM

Heh, didn't think people will really need/like this. :)

Let's have a vote, do you want support for original templates?
I think it's useless, cuss if you're gonna be editing a template a lot of times it will only be original when you first edit it.

Alien 09-23-2001 11:00 AM

Really don't need that support myself. :)

This is great, it's saving me from carpal tunnel!

holev 09-23-2001 12:43 PM

i did everything right and selected Yes but it wont return to the same page.

Delu 10-05-2001 07:39 AM

i did all as u wrote and didn't work...
when i edited a template i checked "yes" and nothing new hpanned...it moved me to the main templates page...

Admin 10-05-2001 09:07 AM

Did you add what I said in this block?
PHP Code:

// ###################### Start edit #######################
if ($action=="edit") {
// blbala



FWC 11-02-2001 05:24 AM

Firefly, does this work in 2.2.0? I had it installed in 2.0.3. I've tried adding it twice to the new version. I'm not getting anything. I'm probably just doing something wrong. Please tell me it works so I can send myself to the dumbass room. :)

Admin 11-02-2001 11:32 AM

Yup, works great. :)

Lesane 11-02-2001 03:28 PM

Thanks for this nice & neat hack FireFly ;)

silence 11-02-2001 07:08 PM

I so needed this. lol

FWC 11-02-2001 07:40 PM

Quote:

Originally posted by FireFly
Yup, works great. :)
OK, I just returned from the dumbass room. I looked at my 2.0.3 template.php and the new 2.2.0 version. I had to move the makeyesnocode line up one. The javascript runs to make the box before it saw the line. It works now. I can't live without that thing. :D

SirSteve 11-04-2001 04:52 AM

This is what mine looks like:

// ###################### Start do update #######################
if ($HTTP_POST_VARS['action']=="doupdate") {

So, I cannot move this block... ?

Admin 11-04-2001 12:00 PM

Why not?
That's exactly what you should have.

SirSteve 11-05-2001 05:02 AM

This is what the hack says:

// ###################### Start do update #######################
if ($HTTP_POST_VARS['action']=="doupdate") {
// a few lines of code here
}

-------------------------------------------------

This is mine:

// ###################### Start do update #######################
if ($HTTP_POST_VARS['action']=="doupdate") {

$DB_site->query("UPDATE template SET templatesetid=$templatesetid,title='".addslashes(" $title")."',template='".addsla shes("$template")."' WHERE templateid=$templateid");

echo "<p>Done!</p>";
if ($return) {
$action="edit";
} else {
$action="modify";
$expandset=$templatesetid;
}
}

----------------------------------------------------------

This is correct?

Admin 11-05-2001 10:56 AM

By this:
Code:

// a few lines of code here
I mean there are some lines of code there I didn't want to specify.
So yes, that's correct.

amykhar 11-05-2001 01:42 PM

Firefly,

in 2.2, this code:

PHP Code:

makehiddencode("group""$group"); 

seems to be in two places. The first place puts the checkbox in the unedited templates ( but it doesn't work, as you said it wouldn't)

the second place is the one you want.

Amy

SirSteve 11-05-2001 05:56 PM

Working great on v2.2.0 !

Thanks!

Admin 11-05-2001 06:49 PM

Thanks Amy, I edited the first post (I did it earlier but didn't have the time to reply, sorry). :)

snyx 11-10-2001 05:36 PM

love this little hack :D

LuBi 11-12-2001 04:44 AM

I keep having trouble posting whole edited .php files. I think it's my software to edit them I am using Editplus 2 but it must be adding something to the end of the document because I'll get a Parse error at the last line of the document. Like I keep getting Parse Error like line 713 with this hack. Can anyone help me?

FWC 11-12-2001 05:57 AM

Quote:

Originally posted by LuBi
I keep having trouble posting whole edited .php files. I think it's my software to edit them I am using Editplus 2 but it must be adding something to the end of the document because I'll get a Parse error at the last line of the document. Like I keep getting Parse Error like line 713 with this hack. Can anyone help me?
I use EditPlus2. I'm not having any problem. Make sure you back the cursor up to the last > if there is anything at the bottom of the file. Also, make sure you have the PHP template and settings and syntax installed in Preferences > Files.

LuBi 11-12-2001 06:06 AM

What settings do you use, I'm not sure what exactly it's doing but I get a parse error with any code I edit on the last line, I guess could you explain everything out a bit more. :confused: thanks again ;)

LuBi 11-12-2001 07:22 PM

This is what the screen looks like, I believe that little thing after the cursor is what causes my trouble. How can I get rid of that?

https://vborg.vbsupport.ru/

LuBi 11-12-2001 08:55 PM

Got everything working now, great hack as usual thanks again!

FWC 11-12-2001 09:04 PM

Quote:

Originally posted by LuBi
Got everything working now, great hack as usual thanks again!
What was the solution with EditPlus2?

LuBi 11-12-2001 09:44 PM

Jezz :o lol thought I could get away without anyone asking. I guess I was doing somehting wrong with this hack and another but it must have been my own error :eek: I feel bad but I don't know what i changed if I did Textpad still doesn't work but EditPlus does so I've already installed 5 hacks with 4 more to come, then the customization begins.

My only worry now is that 2.2.0 isn't that last update someone told me it has bugs, so I dunno why I'm adding hacks unless the update is small and doesn't change a lot... If it does change to much then I give up :o

FWC 11-12-2001 10:52 PM

Quote:

Originally posted by LuBi
My only worry now is that 2.2.0 isn't that last update someone told me it has bugs, so I dunno why I'm adding hacks unless the update is small and doesn't change a lot... If it does change to much then I give up :o
LOL, I'm glad you got things working. The upgrade is just a bug fix. Some people are having problems. I probably won't upgrade. My system works fine as is.

Stretchr 01-20-2002 04:53 PM

Started laughing at this post but when I looked up, I found I was one floor below FWC. Persevered through my ignorance and the third time, I apparently followed the directions and:

What A Great Hack! Thanks for another one, FireFly!
:supwink:

Quote:

Originally posted by Lubi
OK, I just returned from the dumbass room. I looked at my 2.0.3 template.php and the new 2.2.0 version. I had to move the makeyesnocode line up one. The javascript runs to make the box before it saw the line. It works now. I can't live without that thing. :D

Lucky 01-21-2002 10:31 AM

Very impressed.

Thanx again old buddy.

Jawelin 01-21-2002 02:34 PM

Nice, Chen!

Just something: when I edit twice the same template and save it with the 'return to this...' = on, I get in the body of textarea Array instead of the full template text I just saved.

Just seems it looses some brakets value ...
Note: new template is actually saved as 'Array', because if I exited and re-edit, this text is the only existing within body (and even into db)... :(

I dupe-checked the hack just applied and seems having followed your instructions literally.

Thanks a lot.
Bye

Admin 01-22-2002 08:13 AM

Jawelin, that's odd, I've been using this hack for 4 months already and never faced that problem! Do you mind sending me your template.php file by e-mail, so I could have a look and try it out? Thanks. :)

Jawelin 01-25-2002 11:38 AM

It's coming.
Thanks a lot.

P.S.: I think made some mistake near 'few rows below' ... ;)

DelusionalMind 01-25-2002 11:05 PM

nice :)

will be installing in a few :)

Sparkz 01-25-2002 11:35 PM

Great little hack... Really useful.

Kept trying to make this work over and over again on my testboard without success - until I descovered I was actually editing the file on the live site... that's what you get for hacking at 3.30 in the morning... *sigh*


All times are GMT. The time now is 04:48 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
  • Page Generation 0.01338 seconds
  • Memory Usage 1,826KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (8)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete