Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-26-2004, 01:54 PM
MrNase MrNase is offline
 
Join Date: May 2003
Location: Germany
Posts: 670
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default iam stuck with my modification

hey, i hope i got the right forum for my little 'request'.

I have added a new column called 'onfrontpage' to the 'thread' table.
When i make a new thread there's a little selectbox where i can choose something like "is on frontpage". When i select "yes" the column 'onfrontpage' for this thread is filled with '1'. Otherwise it's '0'.

Now here's my problem:

I wan't to have a little '<input type="checkbox">' on showthread.php that shows if this thread is currently on the frontpage (if the columns 'onfrontpage' says '1') so that i can easily change it.

But how do i do that? I've been working on that for 4 hours now but i didn't figure out how to do that yet

I can't select the value of 'onfrontpage' out of the database.

It must be somewhere hidden in the showthread.php or functions_showthread.php.

Is there someone with too much spare time who is willing to help me?
It doesn't need to be a detailed instruction, some hints are more than welcome

regards,
dominik
Reply With Quote
  #2  
Old 02-26-2004, 02:08 PM
vbmechanic vbmechanic is offline
 
Join Date: Jan 2004
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I believe it should be automatically loaded with your thread cache... Check $threadinfo['onfrontpage'] and see if it holds your variable?
Reply With Quote
  #3  
Old 02-26-2004, 02:53 PM
MrNase MrNase is offline
 
Join Date: May 2003
Location: Germany
Posts: 670
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, that did the trick. I deleted that and replaced it with $show[onfrontpage] and that didn't work
Thanks alot

my next problem:

i added the following to the SHOWTHREAD-template
Code:
 <div><label for="cb_onfrontpage"><input type="checkbox" name="do" value="onfrontpage" id="cb_onfrontpage" tabindex="1" $checked[onfrontpage] />Auf der Startseite?</label></div>
and the following to options.php:
Code:
 // ############################### start do set on frontpage ###############################
 if ($_POST['do'] == 'onfrontpage')
 {
 	$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET onfrontpage = $threadinfo[onfrontpage] WHERE threadid = $threadid");
 
 	$_REQUEST['forceredirect'] = 1;
 	$url = "showthread.php?$session[sessionurl]t=$threadid";
 	eval(print_standard_redirect('redirect_openclose'));
 
 }
But it doesn't change the value in the database

If i change $threadinfo[onfrontpage] to '1' or '0' manually he'll change it in the database... wrong variable i try to use?
Reply With Quote
  #4  
Old 02-26-2004, 03:03 PM
vbmechanic vbmechanic is offline
 
Join Date: Jan 2004
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In your query:

"onfrontpage = $threadinfo[onfrontpage]"

You don't want to set the onfrontpage to the $threadinfo value, you want to set it to the form value. I would replace the checkbox value with "1" so that it will feed the database a 1 if it is checked.
Reply With Quote
  #5  
Old 02-26-2004, 03:07 PM
MrNase MrNase is offline
 
Join Date: May 2003
Location: Germany
Posts: 670
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I changed it to
Code:
<div><label for="cb_onfrontpage"><input type="checkbox" name="onfrontpage" value="1" id="cb_onfrontpage" tabindex="1" $checked[onfrontpage] />Auf der Startseite?</label></div>
but there must be a problem with 'name="onfrontpage"'
Reply With Quote
  #6  
Old 02-26-2004, 03:13 PM
vbmechanic vbmechanic is offline
 
Join Date: Jan 2004
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try these:

Code:
<div><label for="cb_onfrontpage"><input type="checkbox" name="onfrontpage" value="1" id="cb_onfrontpage" tabindex="1" $checked[onfrontpage] />Auf der Startseite?</label></div>
and

Code:
// ############################### start do set on frontpage ###############################
 if ($_POST['onfrontpage'] == 1)
 {
 	$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET onfrontpage = 1 WHERE threadid = $threadid");
 
 	$_REQUEST['forceredirect'] = 1;
 	$url = "showthread.php?$session[sessionurl]t=$threadid";
 	eval(print_standard_redirect('redirect_openclose'));
 
 }
Reply With Quote
  #7  
Old 02-26-2004, 03:23 PM
MrNase MrNase is offline
 
Join Date: May 2003
Location: Germany
Posts: 670
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hm that would work but not as i expected.
How can i set onfrontpage to '0' ?
I want it so that you can select with the checkbox if the the post is on the frontpage (onfrontpage = '1') or not (onfrontpage = '0').

With your code it can only set it to '1' but not to '0'.
Reply With Quote
  #8  
Old 02-26-2004, 03:27 PM
vbmechanic vbmechanic is offline
 
Join Date: Jan 2004
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well I don't know where this code is going, so I don't know if it has access to a current $threadinfo... if it does, this would work:

Code:
// ############################### start do set on frontpage ###############################
 if ($_POST['onfrontpage'] != $threadinfo['onfrontpage'])
 {
 	$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET onfrontpage = $_POST['onfrontpage'] WHERE threadid = $threadid");
 
 	$_REQUEST['forceredirect'] = 1;
 	$url = "showthread.php?$session[sessionurl]t=$threadid";
 	eval(print_standard_redirect('redirect_openclose'));
 
 }
Reply With Quote
  #9  
Old 02-26-2004, 03:36 PM
MrNase MrNase is offline
 
Join Date: May 2003
Location: Germany
Posts: 670
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this code is going to options.php line 143
Reply With Quote
  #10  
Old 02-26-2004, 03:45 PM
vbmechanic vbmechanic is offline
 
Join Date: Jan 2004
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

do you mean postings.php? If so, it should have threadinfo and that should work.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:03 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.04138 seconds
  • Memory Usage 2,257KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete