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 10-17-2010, 02:48 PM
BigJohnny's Avatar
BigJohnny BigJohnny is offline
 
Join Date: Jun 2006
Location: Canada
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Removing vBMenu arrow?

How do you remove the arrow beside a popup menu? I have some code that uses the vBmenu class which adds that little down pointing arrow. I need to use the functionality, but since it will be activate over an image I can't have that little arrow show up, but only want to remove it for this one button image.
Reply With Quote
  #2  
Old 10-17-2010, 05:06 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I believe the arrow gets added when you use vbmenu_register with your code. (I think... iirc.)
Reply With Quote
  #3  
Old 10-18-2010, 12:54 AM
BigJohnny's Avatar
BigJohnny BigJohnny is offline
 
Join Date: Jun 2006
Location: Canada
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

but do I not need to use that for the menu to work properly?

Heres the code chunk. When you use it, it makes the button but adds an arrow beside it.

Code:
<!-- NEW EVENT BUTTON DROP DOWN -->
<table cellpadding="0" cellspacing="0" border="0" style="margin-top:3px">
<tr valign="top">
	<td id="add_event"><a href="#goto_newevent" rel="nofollow"><img src="$stylevar[imgdir_button]/newevent.gif" alt="$vbphrase[add_new_event]" border="0" /></a><script type="text/javascript"> vbmenu_register("add_event"); </script></td>

</tr>
</table>

<!-- add event menu -->
<div class="vbmenu_popup" id="add_event_menu" style="display:none">
	<table cellpadding="4" cellspacing="1" border="0">
	<tr>
		<td class="thead">$vbphrase[add_new_event]</td>
	</tr>
	<tr>
		<td class="vbmenu_option">
			<img class="inlineimg" src="$stylevar[imgdir_misc]/calendar_icon.gif" alt="$vbphrase[single_all_day_event]" border="0" />
			<a href="calendar.php?$session[sessionurl]do=add&amp;type=single&amp;c=$calendarinfo[calendarid]">$vbphrase[single_all_day_event]</a>
		</td>
	</tr>
	<tr>
		<td class="vbmenu_option">
			<img class="inlineimg" src="$stylevar[imgdir_misc]/calendar_icon.gif" alt="$vbphrase[ranged_event]" border="0" />
			<a href="calendar.php?$session[sessionurl]do=add&amp;c=$calendarinfo[calendarid]">$vbphrase[ranged_event]</a>
		</td>
	</tr>
	<tr>
		<td class="vbmenu_option">
			<img class="inlineimg" src="$stylevar[imgdir_misc]/calendar_icon.gif" alt="$vbphrase[recurring_event]" border="0" />
			<a href="calendar.php?$session[sessionurl]do=add&amp;type=recur&amp;c=$calendarinfo[calendarid]">$vbphrase[recurring_event]</a>
		</td>
	</tr>
	</table>
</div>
<!-- / NEW EVENT BUTTON DROP DOWN -->
Reply With Quote
  #4  
Old 10-18-2010, 04:10 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You know, a real quick search gives this - https://vborg.vbsupport.ru/showthread.php?t=202383
Reply With Quote
  #5  
Old 10-18-2010, 10:58 AM
BigJohnny's Avatar
BigJohnny BigJohnny is offline
 
Join Date: Jun 2006
Location: Canada
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks lynne.... I don't know how I missed it, but I also had no idea that adding ",true" would remove the friggin arrow.

Working awesome now thanks.

My next question is going to be about regex and how to preg_replace this chunk of code where I need it. I can't seem to get a grasp on that.

I have code already to determine if the code should be inserted or not, I just need to be able to replace a chunk.
Reply With Quote
  #6  
Old 10-18-2010, 01:38 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure exactly what your question is or what you are trying to do next.
Reply With Quote
  #7  
Old 10-18-2010, 07:09 PM
BigJohnny's Avatar
BigJohnny BigJohnny is offline
 
Join Date: Jun 2006
Location: Canada
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry, I was in a hurry this morning when writing that.

I'm using the vBEvents mod, and I have an events forum.

This button we just got working will show on forumdisplay. It will replace "new thread" with "new event" but ONLY in event forums.

Since I don't want to do this with a template conditional, or hardcoded forumid's vBEvents already has a plugin to determine if the forum is an event forum or not.

By default the mod hardcodes an event type option in the ACP so that when a user presses new thread in an event forum, they are redirected to a new event posting with one of the 3 types (single, recurring, ranged). The type is set in the mod options (1,2,3) and can only have one choice.

This button will replace that so in event forums it will be this nice little event type selector drop down box.

What I need to do is use preg_replace to find 2 chunks of code in FORUMDISPLAY and replace them with my own 2 chunks of code respectively.

I have no idea how to use preg_replace or regex, but I already have a plugin to put the code in.
Reply With Quote
  #8  
Old 10-18-2010, 07:33 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I usually use str_replace when I modify template code using that method. Sometimes it is easier to just modify the template though. Exactly what are you trying to find and then replace?
Reply With Quote
  #9  
Old 10-18-2010, 09:19 PM
BigJohnny's Avatar
BigJohnny BigJohnny is offline
 
Join Date: Jun 2006
Location: Canada
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh, maybe str_replace would work too.

I only have half of this sorted at the moment.

I want to replace this
Code:
<!-- controls above thread list -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom:3px">
<tr valign="bottom">
	<td class="smallfont"><if condition="$show['newthreadlink']"><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a><else />&nbsp;</if></td>
	<if condition="$pagenav"><td align="$stylevar[right]">$pagenav</td></if>
</tr>
</table>
<!-- / controls above thread list -->
With this

Code:
<!-- controls above thread list -->
<!-- NEW EVENT BUTTON DROP DOWN -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom:3px">
<tr valign="bottom">
	<td id="add_event" width="6%">
                <if condition="$show['newthreadlink']"><a href="#goto_newevent" rel="nofollow"><img src="$stylevar[imgdir_button]/newevent.gif" alt="$vbphrase[add_new_event]" border="0" /></a><script type="text/javascript"> vbmenu_register("add_event", true); </script>
                <else />&nbsp;
                </if>
        </td>

<if condition="$pagenav"><td align="$stylevar[right]" width="94%">$pagenav</td></if>
</tr>
</table>

<!-- Add Event Menu -->
<div class="vbmenu_popup" id="add_event_menu" style="display:none">
	<table cellpadding="4" cellspacing="1" border="0">
	<tr>
		<td class="thead">Add New Event</td>
	</tr>
	<tr>
		<td class="vbmenu_option">
			<img class="inlineimg" src="$stylevar[imgdir_misc]/calendar_icon.gif" alt="Single, All Day Event" border="0" />
			<a href="calendar.php?$session[sessionurl]do=add&amp;type=single&amp;c=$calendarinfo[calendarid]">Single, All Day Event</a>
		</td>
	</tr>
	<tr>
		<td class="vbmenu_option">
			<img class="inlineimg" src="$stylevar[imgdir_misc]/calendar_icon.gif" alt="Ranged Event" border="0" />
			<a href="calendar.php?$session[sessionurl]do=add&amp;c=$calendarinfo[calendarid]">Ranged Event</a>
		</td>
	</tr>
	<tr>
		<td class="vbmenu_option">
			<img class="inlineimg" src="$stylevar[imgdir_misc]/calendar_icon.gif" alt="Recurring Event" border="0" />
			<a href="calendar.php?$session[sessionurl]do=add&amp;type=recur&amp;c=$calendarinfo[calendarid]">Recurring Event</a>
		</td>
	</tr>
	</table>
</div>
<!-- / Add Event Menu -->
<!-- / NEW EVENT BUTTON DROP DOWN -->
<!-- / controls above thread list -->
Then I need to replace this

Code:
<!-- controls below thread list -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-top:3px">
<tr valign="top">
	<td class="smallfont"><if condition="$show['newthreadlink']"><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a><else />&nbsp;</if></td>

	<if condition="$show['pagenav'] OR $show['inlinemod']">
		<td align="$stylevar[right]">$pagenav
		<if condition="$show['inlinemod']">
			<div class="smallfont" style="text-align:$stylevar[left]; white-space:nowrap; float:$stylevar[right]">
			<if condition="$show['pagenav']"><br /></if><strong>$vbphrase[moderation]</strong><br />
			<select name="do">
				<if condition="$show['deletethread'] OR $show['spamctrls'] OR $show['openthread'] OR $show['approvethread'] OR $show['movethread'] OR $template_hook['inlinemod_thread_bottom']">
				<optgroup label="$vbphrase[option]">
					<if condition="$show['deletethread']">
					<option value="deletethread">$vbphrase[delete_threads]</option>
					<option value="undeletethread">$vbphrase[undelete_threads]</option>
					</if>
					<if condition="$show['spamctrls']">
					<option value="spamthread">$vbphrase[delete_threads_as_spam]</option>
					</if>
					<if condition="$show['openthread']">
					<option value="open">$vbphrase[open_threads]</option>
					<option value="close">$vbphrase[close_threads]</option>
					</if>
					<if condition="$show['approvethread']">
					<option value="approvethread">$vbphrase[approve_threads]</option>
					<option value="unapprovethread">$vbphrase[unapprove_threads]</option>
					</if>
					<if condition="$show['movethread']">
					<option value="stick">$vbphrase[stick_threads]</option>
					<option value="unstick">$vbphrase[unstick_threads]</option>
					<option value="movethread">$vbphrase[move_threads]</option>
					<option value="mergethread">$vbphrase[merge_threads]</option>
					</if>
					$template_hook[inlinemod_thread_bottom]
				</optgroup>
				</if>
				<optgroup label="____________________">
					<option value="viewthread">$vbphrase[view_selected_threads]</option>
					<option value="clearthread">$vbphrase[clear_thread_list]</option>
				</optgroup>
			</select><input type="submit" class="button" id="inlinego" value="$vbphrase[go]" />
			</div>
			<script type="text/javascript">
			<!--
			inlineMod = new vB_Inline_Mod('inlineMod', 'thread', 'inlinemodform', '$vbphrase[go_x]');
			//-->
			</script>
		</if>
		</td>
	</if>
</tr>
</table>
<!-- / controls below thread list -->
With this, Except this doesn't quite work. The menu doesn't open in the correct spot if you can see the inline moderation options.

Code:
<!-- controls below thread list -->
<!-- NEW EVENT BUTTON DROP DOWN -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-top:3px">
<tr valign="top">
	<td id="add_event" width="6%">
                <if condition="$show['newthreadlink']"><a href="#goto_newevent" rel="nofollow"><img src="$stylevar[imgdir_button]/newevent.gif" alt="$vbphrase[add_new_event]" border="0" /></a><script type="text/javascript"> vbmenu_register("add_event", true); </script>
<!-- Add Event Menu -->
<div class="vbmenu_popup" id="add_event_menu" style="display:none">
    <table cellpadding="4" cellspacing="1" border="0">
    <tr>
        <td class="thead">Add New Event</td>
    </tr>
    <tr>
        <td class="vbmenu_option">
            <img class="inlineimg" src="$stylevar[imgdir_misc]/calendar_icon.gif" alt="Single, All Day Event" border="0" />
            <a href="calendar.php?$session[sessionurl]do=add&amp;type=single&amp;c=$calendarinfo[calendarid]">Single, All Day Event</a>
        </td>
    </tr>
    <tr>
        <td class="vbmenu_option">
            <img class="inlineimg" src="$stylevar[imgdir_misc]/calendar_icon.gif" alt="Ranged Event" border="0" />
            <a href="calendar.php?$session[sessionurl]do=add&amp;c=$calendarinfo[calendarid]">Ranged Event</a>
        </td>
    </tr>
    <tr>
        <td class="vbmenu_option">
            <img class="inlineimg" src="$stylevar[imgdir_misc]/calendar_icon.gif" alt="Recurring Event" border="0" />
            <a href="calendar.php?$session[sessionurl]do=add&amp;type=recur&amp;c=$calendarinfo[calendarid]">Recurring Event</a>
        </td>
    </tr>
    </table>
</div>
<!-- / Add Event Menu -->
                <else />&nbsp;
                </if>
        </td>

	<if condition="$show['pagenav'] OR $show['inlinemod']">
		<td align="$stylevar[right]">$pagenav
		<if condition="$show['inlinemod']">
			<div class="smallfont" style="text-align:$stylevar[left]; white-space:nowrap; float:$stylevar[right]">
			<if condition="$show['pagenav']"><br /></if><strong>$vbphrase[moderation]</strong><br />
			<select name="do">
				<if condition="$show['deletethread'] OR $show['spamctrls'] OR $show['openthread'] OR $show['approvethread'] OR $show['movethread'] OR $template_hook['inlinemod_thread_bottom']">
				<optgroup label="$vbphrase[option]">
					<if condition="$show['deletethread']">
					<option value="deletethread">$vbphrase[delete_threads]</option>
					<option value="undeletethread">$vbphrase[undelete_threads]</option>
					</if>
					<if condition="$show['spamctrls']">
					<option value="spamthread">$vbphrase[delete_threads_as_spam]</option>
					</if>
					<if condition="$show['openthread']">
					<option value="open">$vbphrase[open_threads]</option>
					<option value="close">$vbphrase[close_threads]</option>
					</if>
					<if condition="$show['approvethread']">
					<option value="approvethread">$vbphrase[approve_threads]</option>
					<option value="unapprovethread">$vbphrase[unapprove_threads]</option>
					</if>
					<if condition="$show['movethread']">
					<option value="stick">$vbphrase[stick_threads]</option>
					<option value="unstick">$vbphrase[unstick_threads]</option>
					<option value="movethread">$vbphrase[move_threads]</option>
					<option value="mergethread">$vbphrase[merge_threads]</option>
					</if>
					$template_hook[inlinemod_thread_bottom]
				</optgroup>
				</if>
				<optgroup label="____________________">
					<option value="viewthread">$vbphrase[view_selected_threads]</option>
					<option value="clearthread">$vbphrase[clear_thread_list]</option>
				</optgroup>
			</select><input type="submit" class="button" id="inlinego" value="$vbphrase[go]" />
			</div>
			<script type="text/javascript">
			<!--
			inlineMod = new vB_Inline_Mod('inlineMod', 'thread', 'inlinemodform', '$vbphrase[go_x]');
			//-->
			</script>
		</if>
		</td>
	</if>
</tr>
</table>
<!-- / NEW EVENT BUTTON DROP DOWN -->
<!-- / controls below thread list -->
Then I need to make some changes to showthread to either modify the "new thread" button in the same way or I need to remove the code for the "new thread" button which is probably what I will do.

The complications come into play because these buttons only need to be modified for certain forums, which are subject to change, so I need to be able to have it done through plugins to avoid having to modify a ton of templates if I want to add a new event forum or remove one etc.
Reply With Quote
  #10  
Old 10-18-2010, 10:36 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would just do a template edit. That is way too much - along with a bunch of conditions - to be wanting to do a str_replace with.
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 05:57 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.05779 seconds
  • Memory Usage 2,293KB
  • 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
  • (5)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