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 06-26-2009, 07:04 AM
EidolonAH EidolonAH is offline
 
Join Date: Apr 2009
Location: London, England
Posts: 178
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default if a:active else condition problem!

I'm trying to hide the navbar menu by replacing it with an active button, when the button is clicked I want the active button to go away and the navbar menu to replace the active button. I figured it would be as simple as using an if statement, but for the life of me I have no idea what sort of if statement to use.
To get it started I have used the standard (if condition equals show), as below:
Code:
<!-- nav buttons bar -->
<if condition="$show['menuselectnav a:active']">
<div class="tborder" style="padding:$stylevar[cellspacing]px; border-top-width:0px">
	<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
	<tr align="center">
		<if condition="$show['member']">
			<td class="vbmenu_control"><a href="usercp.php$session[sessionurl_q]">$vbphrase[user_cp]</a></td>
		</if>
		<if condition="$show['registerbutton']">
			<td class="vbmenu_control"><a href="register.php$session[sessionurl_q]" rel="nofollow">$vbphrase[register]</a></td>
		</if>
		$template_hook[navbar_buttons_left]
		<td class="vbmenu_control"><a rel="help" href="faq.php$session[sessionurl_q]" accesskey="5">$vbphrase[faq]</a></td>
		<if condition="$show['communitylink'] AND $show['popups']">
			<td class="vbmenu_control"><a id="community" href="$show[nojs_link]#community" rel="nofollow" accesskey="6">$vbphrase[community]</a> <script type="text/javascript"> vbmenu_register("community"); </script></td>
		<else />
			<if condition="$show['memberslist']">
				<td class="vbmenu_control"><a href="memberlist.php$session[sessionurl_q]">$vbphrase[members_list]</a></td>
			</if>
			<if condition="$show['quick_links_groups']">
				<td class="vbmenu_control"><a href="group.php?$session[sessionurl]">$vbphrase[social_groups]</a></td>
			</if>
		</if>
		<td class="vbmenu_control"><a href="calendar.php$session[sessionurl_q]">$vbphrase[calendar]</a></td>
		<if condition="$show['popups']">
			<if condition="$show['searchbuttons']">
				<if condition="$show['member']">
				<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td>
				<else />
				<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getdaily" accesskey="2">$vbphrase[todays_posts]</a></td>
				</if>
				<td class="vbmenu_control"><a id="navbar_search" href="search.php$session[sessionurl_q]" accesskey="4" rel="nofollow">$vbphrase[search]</a> <if condition="$show['quicksearch']"><script type="text/javascript"> vbmenu_register("navbar_search"); </script></if></td>
			</if>
			<if condition="$show['member']">
				<td class="vbmenu_control"><a id="usercptools" href="$show[nojs_link]#usercptools" accesskey="3">$vbphrase[quick_links]</a> <script type="text/javascript"> vbmenu_register("usercptools"); </script></td>
			</if>
		<else />
			<if condition="$show['searchbuttons']">
				<td class="vbmenu_control"><a href="search.php$session[sessionurl_q]" accesskey="4">$vbphrase[search]</a></td>
				<if condition="$show['member']">
				<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td>
				<else />
				<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getdaily" accesskey="2">$vbphrase[todays_posts]</a></td>
				</if>
			</if>
			<td class="vbmenu_control"><a href="forumdisplay.php?$session[sessionurl]do=markread" rel="nofollow">$vbphrase[mark_forums_read]</a></td>
			<if condition="$show['member']">
				<td class="vbmenu_control"><a href="#" onclick="window.open('misc.php?$session[sessionurl]do=buddylist&amp;focus=1','buddylist','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=250,height=300'); return false;">$vbphrase[open_contacts]</a></td>
			</if>
		</if>
		$template_hook[navbar_buttons_right]
		<if condition="$show['member']">
			<td class="vbmenu_control"><a href="login.php?$session[sessionurl]do=logout&amp;logouthash=$bbuserinfo[logouthash]" onclick="return log_out('$vbphrase[sure_you_want_to_log_out]')">$vbphrase[log_out]</a></td>
		</if>
		</tr>
	</table>
</div>
<else>
<div class="menuselectnav"></div>
</if>
<!-- / nav buttons bar -->
Obviously this doesn't work as the if statement doesn't really make sense, in spoken language terms it makes perfect sense but of course coding isn't the same, *sigh*.

This is the css for the menuselectnav button
Code:
.menuselectnav {
	list-style: none;
	margin-left: auto;
	margin-right: auto;
	padding: 0;
	overflow: hidden;
}
.menuselectnav {
	width: 100px;
	height: 30px;
}
.menuselectnav a {
	display: inline-block;
	padding: 0px;
	background-image: url(images/skins/cyclone/buttons/button_menuselect.gif);
    background-position:right top;
    background-repeat:no-repeat;
	width: 100px;
	height: 30px;
}
.menuselectnav a:hover,
.menuselectnav a:focus,
.menuselectnav a:active {
	background-image: url(images/skins/cyclone/buttons/button_menuselect.gif);
    background-position:left top;
    background-repeat:no-repeat;
}
Does anyone know what the if statement should be and if so could you share that information please.

--------------- Added [DATE]1246088101[/DATE] at [TIME]1246088101[/TIME] ---------------
Reply With Quote
  #2  
Old 06-29-2009, 08:30 AM
EidolonAH EidolonAH is offline
 
Join Date: Apr 2009
Location: London, England
Posts: 178
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No one has any ideas!
Reply With Quote
  #3  
Old 06-29-2009, 01:49 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$show is a variable that gets defined in the code. I am guessing that $show['menuselectnav a:active'] was never defined (and I wouldn't use a variable name like that either). Basically your condition is not a valid one (which you already figured out). When someone clicks on the link, are they going to a new page? If so, you can use THIS_SCRIPT in the condition.
Reply With Quote
  #4  
Old 06-29-2009, 05:08 PM
EidolonAH EidolonAH is offline
 
Join Date: Apr 2009
Location: London, England
Posts: 178
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, a new page is not to load up, it's a little difficult for me to explain, perhaps the best thing is to show you the function working on a live site:
http://ggweb-fr.com/phpbbfre/
If you scrolldown to the very bottom of the forum and look to the right you will see a small graphic with a green arrow and the copyright symbol to the right of it, click that button, you will see the sites copyright appear below.
I would like to achieve something like that, except, I would like a three phase effect, the default button would need to look like this:
Attachment 101223
then when one loses over the button it is to look like this:
Attachment 101224
then when one clicks the button it looks like this:
Attachment 101225
Reply With Quote
  #5  
Old 06-29-2009, 10:45 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you look at the source code for the page, you'll see they are just using javascript for that. You can probably get the script name in the code there.
Reply With Quote
  #6  
Old 06-30-2009, 07:16 AM
EidolonAH EidolonAH is offline
 
Join Date: Apr 2009
Location: London, England
Posts: 178
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow, javascript is horrible, I can't quite get it right, this is what I'm doing:

In the header I have this:
Code:
<div  id="wrap">
<!-- logo -->
<a name="top"></a>
    <div id="logo_block">
        <div id="logonav"><a href="$vboptions[forumhome].php$session[sessionurl_q]" title="$vboptions[bbtitle]"></a></div>
    </div>   
    <div id="border_block">
        <div id="borderleft">
            <div id="borderright">
                <div id="content_main" class="bodyfill">
                    <!-- content table -->
                        $spacer_open
                        $_phpinclude_output
                        $ad_location[ad_header_end]
                        <!-- nav buttons bar -->
                        <div style="text-align:center">
                        <a href="#" onclick="dom_toggle.toggle('menu_display', 'menu_open_close', 'images/skins/cyclone/buttons/button_menu_open.gif', 'images/skins/cyclone/buttons/button_menu_close.gif'); return false;"><img src="images/skins/cyclone/buttons/button_menu_open.gif" class="menutoggle" id="menu_open_close" alt="" /></a>
                        <div class="tborder" style="padding:$stylevar[cellspacing]px; border-top-width:0px">
                        	<table cellpadding="0" cellspacing="0" border="0" width="100%">
                        	<tr align="center">
                        		<if condition="$show['member']">
                        			<td class="vbmenu_control"><a href="usercp.php$session[sessionurl_q]">$vbphrase[user_cp]</a></td>
                        		</if>
                        		<if condition="$show['registerbutton']">
                        			<td class="vbmenu_control"><a href="register.php$session[sessionurl_q]" rel="nofollow">$vbphrase[register]</a></td>
                        		</if>
                        		$template_hook[navbar_buttons_left]
                        		<td class="vbmenu_control"><a rel="help" href="faq.php$session[sessionurl_q]" accesskey="5">$vbphrase[faq]</a></td>
                        		<if condition="$show['communitylink'] AND $show['popups']">
                        			<td class="vbmenu_control"><a id="community" href="$show[nojs_link]#community" rel="nofollow" accesskey="6">$vbphrase[community]</a> <script type="text/javascript"> vbmenu_register("community"); </script></td>
                        		<else />
                        			<if condition="$show['memberslist']">
                        				<td class="vbmenu_control"><a href="memberlist.php$session[sessionurl_q]">$vbphrase[members_list]</a></td>
                        			</if>
                        			<if condition="$show['quick_links_groups']">
                        				<td class="vbmenu_control"><a href="group.php?$session[sessionurl]">$vbphrase[social_groups]</a></td>
                        			</if>
                        		</if>
                        		<td class="vbmenu_control"><a href="calendar.php$session[sessionurl_q]">$vbphrase[calendar]</a></td>
                        		<if condition="$show['popups']">
                        			<if condition="$show['searchbuttons']">
                        				<if condition="$show['member']">
                        				<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td>
                        				<else />
                        				<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getdaily" accesskey="2">$vbphrase[todays_posts]</a></td>
                        				</if>
                        				<td class="vbmenu_control"><a id="navbar_search" href="search.php$session[sessionurl_q]" accesskey="4" rel="nofollow">$vbphrase[search]</a> <if condition="$show['quicksearch']"><script type="text/javascript"> vbmenu_register("navbar_search"); </script></if></td>
                        			</if>
                        			<if condition="$show['member']">
                        				<td class="vbmenu_control"><a id="usercptools" href="$show[nojs_link]#usercptools" accesskey="3">$vbphrase[quick_links]</a> <script type="text/javascript"> vbmenu_register("usercptools"); </script></td>
                        			</if>
                        		<else />
                        			<if condition="$show['searchbuttons']">
                        				<td class="vbmenu_control"><a href="search.php$session[sessionurl_q]" accesskey="4">$vbphrase[search]</a></td>
                        				<if condition="$show['member']">
                        				<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td>
                        				<else />
                        				<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getdaily" accesskey="2">$vbphrase[todays_posts]</a></td>
                        				</if>
                        			</if>
                        			<td class="vbmenu_control"><a href="forumdisplay.php?$session[sessionurl]do=markread" rel="nofollow">$vbphrase[mark_forums_read]</a></td>
                        			<if condition="$show['member']">
                        				<td class="vbmenu_control"><a href="#" onclick="window.open('misc.php?$session[sessionurl]do=buddylist&amp;focus=1','buddylist','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=250,height=300'); return false;">$vbphrase[open_contacts]</a></td>
                        			</if>
                        		</if>
                        		$template_hook[navbar_buttons_right]
                        		<if condition="$show['member']">
                        			<td class="vbmenu_control"><a href="login.php?$session[sessionurl]do=logout&amp;logouthash=$bbuserinfo[logouthash]" onclick="return log_out('$vbphrase[sure_you_want_to_log_out]')">$vbphrase[log_out]</a></td>
                        		</if>
                        		</tr>
                        	</table>
                        </div>
                        </div>
                        <!-- / nav buttons bar -->
In the headinclude I have this:
Code:
<script type="text/javascript" src="$stylevar[imgdir_misc]/js_dom_toggle.js"></script>
In the .js file there is this:
Code:
function _dom_toggle()
{
	return this;
}
	_dom_toggle.prototype.objref = function(id)
	{
		return document.getElementById ? document.getElementById(id) : (document.all ? document.all[id] : (document.layers ? document.layers[id] : null));
	}

	_dom_toggle.prototype.cancel_event = function()
	{
		if ( window.event )
		{
			window.event.cancelBubble = true;
		}
	}

	_dom_toggle.prototype.toggle = function(id, open_close_id, open_icon, close_icon)
	{
		var object = this.objref(id);
		var icon = this.objref(open_close_id);

		if ( object && object.style )
		{
			object.style.display = (object.style.display == 'none') ? '' : 'none';
			if ( icon && icon.src )
			{
				icon.src = (object.style.display == 'none') ? open_icon : close_icon;
			}
		}
		this.cancel_event();
	}

// instantiate
dom_toggle = new _dom_toggle();
For the css I have this:
Code:
.menutoggle {
	margin: 0;
	padding: 0;
        border:0px;
	width: 200px;
	height: 30px;
}
.menutoggle a:hover {
	background: url(images/skins/cyclone/buttons/button_menu_impel.gif);
	margin: 0;
	padding: 0;
        border:0px;
	width: 200px;
	height: 30px;
}
The hover effect is not working, the menu is displayed by default, the javascript isn't running when I click the menu button.
Any ideas on what I have got wrong?
Reply With Quote
  #7  
Old 07-02-2009, 07:14 AM
EidolonAH EidolonAH is offline
 
Join Date: Apr 2009
Location: London, England
Posts: 178
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's too weird huh, I understand, I do not wish to seem a stress head or anything but for my own sanity, should I consider that no-one knows the solution and move on?
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 10:31 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04211 seconds
  • Memory Usage 2,263KB
  • Queries Executed 12 (?)
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
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete