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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-25-2009, 11:13 PM
Frank H. Shaw Frank H. Shaw is offline
 
Join Date: Aug 2007
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default I have done all i can do to modify the templete calandar_jump to the gobutton

I might be off the wall but here is my trouble:

In the templete that calls this function "trap_calandar_jump" the templete part that does the calling is below:

PHP Code:

<select name="c" onchange="trap_calandar_jump('1'),  this.form.submit();"
You will see that i have add the "trap_calandar_jump('1'), this.form.submit() to happen at the same time the trap_calandar_jump but the second on does not because I have to press the go my self?

How do I make this work?

I created this function in the php file function_calandar.php

PHP Code:

function trap_calandar_jump($jump)
{

switch (
$jump) {

case 
1:
// Logic here Jump drop down 1

break;
case 
2:
// Logic here Jump drop down 2

break;
case 
3:
// Logic here Jump drop down 3

break;


}
//switch 

}

The templete that is used in the calandar in vb calandar which is where I try everything -

PHP Code:

<strong>$vbphrase[calendar_jump]</strong><br />

<
select name="c" onchange="trap_calandar_jump('1'),  this.form.submit();">

<
optgroup label="$vbphrase[please_select_one]>

$jumpcalendarbits

</optgroup>

</
select>$gobutton 
Using the onchange event can I call the two functions at the same time?

That sames to work except for the thing before when the user selected a option in the drop down because the onchange event caused the auto press of the go button. Now that I have added the second function to the onchange event that functionlty is lost and the user has to press the go.

How can i do both call the function and the action of pressing the go button with the user having to press it.

If you have been following some of my post you will know that the templete calendar_jump above is not the whole thing and in my case i am using any number of jump calandar dropdown in the form. I have simplefied the templete so as not to confuse the issues and what i am asking here.

THANKS

Frank H. Shaw
Reply With Quote
  #2  
Old 02-26-2009, 11:55 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can not call a PHP function from a template. If you need a function to be processed you will need to write it in JS.
Reply With Quote
  #3  
Old 02-26-2009, 02:17 PM
Frank H. Shaw Frank H. Shaw is offline
 
Join Date: Aug 2007
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have been able to play with the function that I am calling here is as far as i have gotten so far on it.

Please review it and tell me what you think - how i am doing and is there a better way then what i am doing.

The function that is the first function does get called because I put some debuging in it so I know that happens so if have correct logic in my function then it should all work as I want it to.

But you say i can not do it from a templete form with out using js well i am using the onchange event and I hope the event is the best one for my purposes here.

Please explain more why you are saying what you said in your replay so that I understand what you mean.

This is what you said:

Quote:

You can not call a PHP function from a template. If you need a function to be processed you will need to write it in JS.
Here below is how far i have gotten so far.


PHP Code:

function trap_calandar_jump($jump)
{
    
$debugmsg $jump;       // This is my debuging stuff so i know the function does get called.
    
    
switch ($jump) {

    case 
1:
        
// Logic here  Jump drop down 1
         
$page $_GET["c"];
         
$url "http://www.burningtaper.org/forums/calendar.php?s=&month=3&year=2009&do=&c=" .$page;
         
ob_end_clean(); 
         
header("Location: " $url); 
        break;
    case 
2:
        
// Logic here Jump drop down 2
         
$page $_GET["y"];
         
$url "http://www.burningtaper.org/forums/calendar.php?s=&month=3&year=2009&do=&y=" .$page;
         
ob_end_clean(); 
         
header("Location: " $url); 
        
        break;
    case 
3:
        
// Logic here Jump drop down 3
         
$page $_GET["z"];
         
$url "http://www.burningtaper.org/forums/calendar.php?s=&month=3&year=2009&do=&z=" .$page;
         
ob_end_clean(); 
         
header("Location: " $url); 
        
        break;


}
//switch
    


If you look at back at the orginal post you will see that the use of the $_GET I can stuff the redirect with the value of the selected calandar ID because the value is in the $_GET for c, y, z, and only c is the orginal from the first jump_calandar.

You can see that the value is put in the $_GET because it is in the address bar of the browser.

Below is the url just a sample

PHP Code:

http
://www.mydomain.org/forums/calendar.php?s=&month=2&year=2009&do=&c=16&y=2&z=23 
So by doing a redierct and so that the target of the new url should make the correct calandar from the other two dropdowns.

Now if there is nothing in the way VB handles the going to the calandar in there logic to undo what I have done then this should work.

If any one know different and or knows of such logic that i would have to address or look at on this please let me know.

THANKS

Frank H. Shaw
Reply With Quote
  #4  
Old 02-27-2009, 11:22 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are calling "$_GET" as a function, and passing a parameter to it. Use square brackets to get array values.

You need to use a forward slash on the end BB Code (e.g. [/php]) - this is starting to get really annoying.
Reply With Quote
  #5  
Old 02-27-2009, 02:58 PM
Frank H. Shaw Frank H. Shaw is offline
 
Join Date: Aug 2007
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I reakky did not see the fact that I had ( ) unstead of the array [ ] that was due to the fact my eyes are not the greatest - I do not know why the PHP compirer did not throw a error.

I have coreeted the and now the script code is indeneted as you say is easyer for you to read.

Now that I have corrected my errors that had in my script I still need the question answred that I asked in the first place - would you kindly review my questions and see if you can follow what i am asking and answer some of the questions.

THANKS

Frank H. Shaw

--------------- Added [DATE]1235766032[/DATE] at [TIME]1235766032[/TIME] ---------------

I have simplfied the select so that i am only want to call the functon on a onchange event from a templete and it seems that my function is never getting called and I thought it was.

So i am regressing to ask this lets start over in the Jump_Calandar the templete that comes out of the box with the product unmodifyed.

I need to take the "this.form.submit()" which is the thing that happens when the user makes a selection in the dropdown Jump_Calandar now unstead I want to call a function from my templete so the function is called "trap_calandar_jump('1')" At first i thought that i would be able to attach to functions to the onchange event but now I realize that my actual function never gets called so before i can even attempt having two functions i need to get the calling of my function to work first. {I do not even now if it is posiable to call two function from the onchange event}

So what do I have to do to setup my function and get to call the function from the onchange event from the templete Jump_Calandar?

Please explain step by step what needs to be done!

PHP Code:
<select name="c" onchange="trap_calandar_jump('1'),  this.form.submit();"
I change it to this

PHP Code:
<select name="c" onchange="trap_calandar_jump('1')"
The orginal was this out of the box

PHP Code:
<select name="c" onchange="this.form.submit();"

Here is the actaul one the change Jump_Calandar that I changed drasticly as you can see so you have a idea what i am trying to do I might be using the wrong event but i felt the onchange event was my best choice.

PHP Code:

<form action="calendar.php" method="get">
<
div class="smallfont" style="text-align:$stylevar[left]; white-space:nowrap">
    <
input type="hidden" name="s" value="$session[sessionhash]/>
    <
input type="hidden" name="month" value="$month/>
    <
input type="hidden" name="year" value="$year/>
    <
input type="hidden" name="do" value="$docalendar/>
    <
strong>$vbphrase[calendar_jump]</strong><br />
        <
input type="hidden" name="me" value="1" />
        <
select name="c" onchange="this.form.submit();">
        <
optgroup label="$vbphrase[please_select_one]>
                
$jumpcalendarbits
        
</optgroup>
                <
optgroup label="$vbphrase[Blue_Lodge_Regular_Meetings]>
                
$jumpcalendarbitsb
        
</optgroup>
                <
optgroup label="$vbphrase[York_Rite_Regular_Meetings]>
                </
optgroup>
                <
optgroup label="$vbphrase[Chapters]>
                
$jumpcalendarbitsy
        
</optgroup>
                <
optgroup label="$vbphrase[End_Of_Jump_Menu]>
                </
optgroup>
        </
optgroup>
                <
optgroup label="$vbphrase[Councils]>
                </
optgroup>
        </
optgroup>
                <
optgroup label="$vbphrase[Commanderys]>
                </
optgroup>
        </
optgroup>
                <
optgroup label="$vbphrase[Scottish_Rite]>
                </
optgroup>
                <
optgroup label="$vbphrase[Valleys]>
                </
optgroup>
                <
optgroup label="$vbphrase[Shriners]>
                </
optgroup>
                <
optgroup label="$vbphrase[Shrine_Clubs]>
                </
optgroup>
                <
optgroup label="$vbphrase[Units]>
                </
optgroup>
    </
select>$gobutton <br />
        <
strong>$vbphrase[Lodge_Calendar]</strong><br />
        <
input type="hidden" name="me" value="2" />
        <
select name="y" onchange="this.form.submit();">
                <
optgroup label="$vbphrase[please_select_one]">
                   
$jumpcalendarbitsl
                
</optgroup>
        </
select>$gobutton <br />
        <
strong>$vbphrase[Chapter_Calendar]</strong><br />
        <
input type="hidden" name="me" value="3" />
        <
select name="z" onchange="this.form.submit();">
                <
optgroup label="$vbphrase[please_select_one]">
                   
$jumpcalendarbitsch
                
</optgroup>
        </
select>$gobutton <br />
</
div>
</
form

I hope this makes more sence and you can follow what i am asking.

Most inport thing is to be able to call the function from the templete with the onchange event or when a selection is made on the dropdown and then if the function can cause the $gobutton get pressed by doing that inside the function that would be also ok in fact might be the best way to do it.

Please note: The key is that I not only need to call the function from the templete but need to pass a value so the function can parse the value passed.

Look at the actual function in the function I need to do a redirect do not know if my redirect is working or will even work until i get my function calling to work in the first place.

But if I get all the redirect to work is there any thing in the vb calandar php scripts that will pervent or override what i do if there is please explain what i need to look at or consder.


THANKS

Frank H. Shaw

--------------- Added [DATE]1235766502[/DATE] at [TIME]1235766502[/TIME] ---------------

Quote:
Originally Posted by Dismounted View Post
You are calling "$_GET" as a function, and passing a parameter to it. Use square brackets to get array values.

You need to use a forward slash on the end BB Code (e.g. [/php]) - this is starting to get really annoying.
I went back and fixed the posting to be corrected I was wondering why the php code was not being able to scroll as you taught me a few months ago to do - so now i think i have it right now.

But now you shoud be able to read my post and answer some if not all my questions THANKS

--------------- Added [DATE]1235773113[/DATE] at [TIME]1235773113[/TIME] ---------------

If i can not use the onchange event to call my user defined function can I use the onclick event to call my user defined function from a templete.

What i have to do is be able to modify my templete above so that it will call my user defined function so that my user defined function can parse the argument pass it and that value based on some logic do a redirect to bring up a different calandar.

THANKS

Frank H. Shaw

--------------- Added [DATE]1235777509[/DATE] at [TIME]1235777509[/TIME] ---------------

The following :

I am trying to call a my own user defined function to parse a value passed to the user defined function and i am haveing a hard time figure out this here is my leastest attemp at this.

I tried to do it a a hidden field but that will not work either before i treid to do it as a onchange event that did not work either could some one help me understand what i do not understand.

Is there a file i need to be looking at beside the two files i have now calandar.php and function_calandar.php?

Here is my latest attemp at this.

Was i closer doing it using the onchange event or is the way the onclick event and can some one give me a clue or example of what the templete should look like for doing this.

The below has a hidden field called me this field i am trying to figure out what select was did the user press to so that I can handle that in my user defined function?

PHP Code:

<form action="calendar.php" method="get">
<
div class="smallfont" style="text-align:$stylevar[left]; white-space:nowrap">
    <
input type="hidden" name="s" value="$session[sessionhash]/>
    <
input type="hidden" name="month" value="$month/>
    <
input type="hidden" name="year" value="$year/>
    <
input type="hidden" name="do" value="$docalendar/>
    <
strong>$vbphrase[calendar_jump]</strong><br />
        <
input type="hidden" name="me" value="onclick="trap_calandar_jump('1')" />
    <select name="
c" onchange="this.form.me">
        <optgroup label="
$vbphrase[please_select_one]" >
                
$jumpcalendarbits
        </optgroup>
                <optgroup label="
$vbphrase[Blue_Lodge_Regular_Meetings]" >
                
$jumpcalendarbitsb
        </optgroup>
                <optgroup label="
$vbphrase[York_Rite_Regular_Meetings]" >
                </optgroup>
                <optgroup label="
$vbphrase[Chapters]" >
                
$jumpcalendarbitsy
        </optgroup>
                <optgroup label="
$vbphrase[End_Of_Jump_Menu]" >
                </optgroup>
        </optgroup>
                <optgroup label="
$vbphrase[Councils]" >
                </optgroup>
        </optgroup>
                <optgroup label="
$vbphrase[Commanderys]" >
                </optgroup>
        </optgroup>
                <optgroup label="
$vbphrase[Scottish_Rite]" >
                </optgroup>
                <optgroup label="
$vbphrase[Valleys]" >
                </optgroup>
                <optgroup label="
$vbphrase[Shriners]" >
                </optgroup>
                <optgroup label="
$vbphrase[Shrine_Clubs]" >
                </optgroup>
                <optgroup label="
$vbphrase[Units]" >
                </optgroup>
    </select>
$gobutton <br />
        <strong>
$vbphrase[Lodge_Calendar]</strong><br />
        <input type="
hidden" name="me" value="onclick="trap_calandar_jump('2')" />
        <
select name="y" onchange="this.form.me">
                <
optgroup label="$vbphrase[please_select_one]">
                   
$jumpcalendarbitsl
                
</optgroup>
        </
select>$gobutton <br />
        <
strong>$vbphrase[Chapter_Calendar]</strong><br />
        <
input type="hidden" name="me" value="onclick="trap_calandar_jump('3')" />
        <select name="
z" onchange="this.form.me">
                <optgroup label="
$vbphrase[please_select_one]">
                   
$jumpcalendarbitsch
                </optgroup>
        </select>
$gobutton <br />
</div>
</form> 
THANKS

Frank H. Shaw

--------------- Added [DATE]1235783480[/DATE] at [TIME]1235783480[/TIME] ---------------

I need to be able to disquegest the select that user used to make the selection so that I can redirect the user to a different calandar then the one that comes up.

The trouble is very simple the first select is over riding the other two select and so when the user makes a selection in the jump_calandar I need that commucated back to the calandar.php.

I have been able to pass the value in the c, y, z as explian and shows up in the $_GET['c'], $_GET['y'], and $_GET['z'] and this is in the address bar of my browser but it takes the first on and forgets about the others.

This is probley due to some logic in calandar.php that looks only at the 'c' in the $_GET now if i can find that logic i miight be able to modify it to handle the other values in the $_GET but I have not found any way to tell me which select that the user made a selection on which dropdown.

Any ideas of how to do this will solve my problem in a nut shell.

THANKS

Frank H. Shaw

--------------- Added [DATE]1235792235[/DATE] at [TIME]1235792235[/TIME] ---------------

I realized the gobutton is defined somewhere and i change the gobutton to make each one different so when one press each one maybe i can tell which one was pressed but when i did this i realized that it is defined somewhere and need to ask where that is?

My thought is if i can change the buttons go to a little different then maybe i could tell in my script which one was pressed. {which is all i am trying to do in the first place}.

THANKS

Frank H. Shaw
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:10 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.05741 seconds
  • Memory Usage 2,325KB
  • 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
  • (10)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete