Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-13-2010, 10:26 PM
Cadellin's Avatar
Cadellin Cadellin is offline
 
Join Date: Jan 2009
Posts: 160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How do I populate editor from database?

I'm working on a custom bug tracker for my site and as part of it I need to be able to edit items that have been previously entered into the system which I can do fine for all fields apart from the editor where I get stuck.

So my question is quite simple: How do I load a message into the vbeditor?

I have searched around quite extensively and thought about it but I can't think of an obvious solution so I thought I would ask in the hope someone can give me a point in the right direction.

Thanks
Reply With Quote
  #2  
Old 11-14-2010, 03:18 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

http://www.w3schools.com/tags/tag_textarea.asp

HTML Code:
<textarea rows="10" cols="60">
      Text here.
      </textarea>
Reply With Quote
  #3  
Old 11-14-2010, 07:54 AM
Cadellin's Avatar
Cadellin Cadellin is offline
 
Join Date: Jan 2009
Posts: 160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Lynne but I don't think I explained my problem properly.

I know how to set the value of a textarea normally but I'm wondering how I do it for vbeditor as unlike the rest of my form it is being loaded from an external location using {vb:raw messagearea}.
Reply With Quote
  #4  
Old 11-14-2010, 02:56 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I guess I don't understand then... if you look at the template for the editor you are using, you'll see something like this for the editor textarea:
HTML Code:
<textarea name="message" id="{vb:raw editorid}_textarea" rows="10" cols="80" tabindex="1" dir="{vb:stylevar textdirection}">{vb:raw newpost.message}</textarea>
so, you'd set $newpost.message to be whatever text you have gotten from your query.
Reply With Quote
  #5  
Old 11-16-2010, 09:50 PM
Cadellin's Avatar
Cadellin Cadellin is offline
 
Join Date: Jan 2009
Posts: 160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks once again Lynne - I'm closing in on the solution.

I'll try to explain my problem differently incase that helps.

I used this article to include the WYSIWYG editor in my custom template. Using the method in that guide the editor is included by using {vb:raw messagearea} - which works fine for posting.

What I'm struggling is using the WYSIWYG editor to edit existing messages.

I've had a good search around the templates & functions but work out where to insert my value="x"
Reply With Quote
  #6  
Old 11-16-2010, 09:59 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you have a custom page for editing this information? And have you written a query that gets the information from the database to edit?
Reply With Quote
  #7  
Old 11-16-2010, 10:10 PM
Cadellin's Avatar
Cadellin Cadellin is offline
 
Join Date: Jan 2009
Posts: 160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've got a custom page, template and written the queries to populate the other fields and update the record on submission all I'm missing is the knowledge where to put the variable which outputs the unedited message.
Reply With Quote
  #8  
Old 11-16-2010, 11:27 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What does the code look like right before (and including) you render the template? and what is the name of the messagetext variable?
Reply With Quote
  #9  
Old 11-17-2010, 07:45 AM
Cadellin's Avatar
Cadellin Cadellin is offline
 
Join Date: Jan 2009
Posts: 160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry I'm not quite sure which bit of the code you mean - I think you mean this bit.

Code:
$templater = vB_Template::create('edittask');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register('type_tasks_options', $type_tasks_options);
$templater->register('task_user_options', $task_user_options);
$templater->register('taskmanagerversion', $taskmanagerversion);
$templater->register('editorid', $editorid); 
$templater->register('messagearea', $messagearea);  
$templater->register('edittask_name', $edittask_name);  
$templater->register('itemid', $itemid);  
$templater->register('edittask_id', $edittask_id); 
$templater->register('edittask_name', $edittask_name); 
$templater->register('edittask_desc', $edittask_desc);  
$templater->register('edittask_assigned', $edittask_assigned);  
$templater->register('edittask_duedate', $edittask_duedate);
print_output($templater->render());
The message text variable is "$edittask_desc"
Reply With Quote
  #10  
Old 11-17-2010, 01:35 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now I see you making a custom template called "edittask", but I have no clue what is in there - how are you using the variable $edittask_desc in the template?
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 01:42 AM.


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.06481 seconds
  • Memory Usage 2,254KB
  • Queries Executed 11 (?)
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
  • (1)bbcode_code
  • (2)bbcode_html
  • (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_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