I would like some ajax help here.
I am trying to make this block load without refreshing the whole page (see screen shots).
When i change the code to make it dynamic, the block is blank.
As you can see the block is present when the page loads, but the contents are blank if I try to do it dynamically.
Page refreshes just to change the content of one block is driving me nuts, so I'd like to figure this one out then I can do others as I see fit.
Thanks for your help!
http://www.mytikibar.com |
ok, I have everything I need up to the point of where I display the block.
I need to display a block by passing this array to it.
temp Array ( [0] => <div class=" bx_sys_default_padding"> <input class="form_input_hidden" type="hidden" name="csrf_token" value="R9Bdw6uPe/xgAwyVg=br" /> <div class="form_advanced_wrapper view_profile_form_wrapper"> <table class="form_advanced_table" cellpadding="0" cellspacing="0"> <tbody > <tr > <td class="caption"> Status: </td> <td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_value" > Active <div class="input_close input_close_value"></div> </div> <img class="warn" alt="error" src="http://dev2.mytikibar.com/templates/tmpl_MyTikiBar/images/icons/exclamation.png" float_info=" " /> <div class="clear_both"></div> </td> </tr> <tr > <td class="caption"> Username: </td> <td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_value" > steve_stevens <div class="input_close input_close_value"></div> </div> <img class="warn" alt="error" src="http://dev2.mytikibar.com/templates/tmpl_MyTikiBar/images/icons/exclamation.png" float_info=" " /> <div class="clear_both"></div> </td> </tr> <tr > <td class="caption"> First Name: </td> <td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_value" > Steve <div class="input_close input_close_value"></div> </div> <img class="warn" alt="error" src="http://dev2.mytikibar.com/templates/tmpl_MyTikiBar/images/icons/exclamation.png" float_info=" " /> <div class="clear_both"></div> </td> </tr> <tr > <td class="caption"> Last Name: </td> <td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_value" > Stevens <div class="input_close input_close_value"></div> </div> <img class="warn" alt="error" src="http://dev2.mytikibar.com/templates/tmpl_MyTikiBar/images/icons/exclamation.png" float_info=" " /> <div class="clear_both"></div> </td> </tr> <tr > <td class="caption"> Sex: </td> <td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_value" > Man <div class="input_close input_close_value"></div> </div> <img class="warn" alt="error" src="http://dev2.mytikibar.com/templates/tmpl_MyTikiBar/images/icons/exclamation.png" float_info=" " /> <div class="clear_both"></div> </td> </tr> <tr > <td class="caption"> Date Of Birth: </td> <td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_value" > 09-16-1965 <div class="input_close input_close_value"></div> </div> <img class="warn" alt="error" src="http://dev2.mytikibar.com/templates/tmpl_MyTikiBar/images/icons/exclamation.png" float_info=" " /> <div class="clear_both"></div> </td> </tr> <tr > <td class="caption"> Age: </td> <td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_value" > 49 <div class="input_close input_close_value"></div> </div> <img class="warn" alt="error" src="http://dev2.mytikibar.com/templates/tmpl_MyTikiBar/images/icons/exclamation.png" float_info=" " /> <div class="clear_both"></div> </td> </tr> <tr > <td class="caption"> City: </td> <td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_value" > North Santee <div class="input_close input_close_value"></div> </div> <img class="warn" alt="error" src="http://dev2.mytikibar.com/templates/tmpl_MyTikiBar/images/icons/exclamation.png" float_info=" " /> <div class="clear_both"></div> </td> </tr> <tr > <td class="caption"> State: </td> <td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_value" > South Carolina <div class="input_close input_close_value"></div> </div> <img class="warn" alt="error" src="http://dev2.mytikibar.com/templates/tmpl_MyTikiBar/images/icons/exclamation.png" float_info=" " /> <div class="clear_both"></div> </td> </tr> <tr > <td class="caption"> Country: </td> <td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_value" > <img src="http://dev2.mytikibar.com/media/images/flags/us.gif" /> United States <div class="input_close input_close_value"></div> </div> <img class="warn" alt="error" src="http://dev2.mytikibar.com/templates/tmpl_MyTikiBar/images/icons/exclamation.png" float_info=" " /> <div class="clear_both"></div> </td> </tr> <tr > <td class="caption"> Zip: </td> <td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_value" > 29148 <div class="input_close input_close_value"></div> </div> <img class="warn" alt="error" src="http://dev2.mytikibar.com/templates/tmpl_MyTikiBar/images/icons/exclamation.png" float_info=" " /> <div class="clear_both"></div> </td> </tr> </tbody>
</table> </div></div> [1] => Array ( [_FieldCaption_General Info_View] => Array ( [href] => /profile.php?ajax=1&ID=24&block=17 [dynamic] => 1 [active] => )
[_FieldCaption_Personal Information_View] => Array ( [href] => /profile.php?ajax=1&ID=24&block=71 [dynamic] => 1 [active] => 1 )
[_FieldCaption_Misc Info_View] => Array ( [href] => /profile.php?ajax=1&ID=24&block=20 [dynamic] => 1 [active] => )
[_FieldCaption_Admin Controls_View] => Array ( [href] => /profile.php?ajax=1&ID=24&block=21 [dynamic] => 1 [active] => )
)
[2] => Array ( )
[3] => )
I know about DesignBoxConten using:
echo DesignBoxContent( _t($sCaption), $aTemp[0], 1 );
but this ONLY outputs the designbox without the top caption that has the menu items in it.
There HAS to be another function that takes into account the top caption.
See previous screen shots.
The function getBlockCode_ returns the array to somewhere, I am not sure where.
Thanks!
http://www.mytikibar.com |
ok, I am now at the point where the block displays, but I am missing the top code.
Please see attached screen shot.
http://www.mytikibar.com |
It printed out the variable name $STopCode instead of passing the variable contents.
By the way, you can pick up the site domain using the built-in dolphin code and include that instead of hard coding in the domain; that makes the code portable.
Geeks, making the world a better place |
Geeks, making the world a better place |
Oh, sorry, that was part of my troubleshooting. I cannot get $sTopCode to build the correct links. That's the issue. LOL
### #If block is ajaxed if($_GET['ajax']){ $iBlockID = $_REQUEST['block'] ? $_REQUEST['block'] : 17; $iPFArea = 8; $oPF = new BxDolProfileFields( $iPFArea ); $aTemp= $oPPV->oProfileGen->showBlockPFBlock($iBlockID, '', $iBlockID, 1); foreach ($aTemp[1] as $key =>$value){ if ($value['active']){ $sCaption = _t($key); break; } }
$sTopCode = $this->_getBlockTopCode($iBlockID, $aBlock, $mBlockCode, $bStatic, $sDynamicType);
echo DesignBoxContent($sCaption, $aTemp[0], 1 ,$sTopCode); exit; }
I think I need to get to this function
classes/BxDolPageView.php:
function _getBlockTopCode($iBlockID, $aBlock, $aBlockCode, $bStatic = true, $sDynamicType = 'tab') {}
I am just unsure of how to get it included in the above IF BLOCK
Thanks!
http://www.mytikibar.com |
You would not include it in the if; you would include it at the top of the script along with any other includes.
Or you may be able to make the function local; not sure there.
Geeks, making the world a better place |
Yeah, but what do I include? http://www.mytikibar.com |
Dolphin has that built in.
I think the two are:
bx_import() and bx_include(). (check of course to make sure I am correct as I may not be)
As an example:
bx_import('BxDolTwigPageView');
Geeks, making the world a better place |
I guess we should ask exactly how you are doing this. Is this a php block you are adding to a page in the builders or otherwise? Geeks, making the world a better place |
I am modifying profile.php and BxBaseprofileView
in BxBaseProfileView in function showBlockPFBlock()
I changed
foreach( $this->aPFBlocks as $iBlockID => $aBlock ) { $aToggleEllements[$aBlock['Caption']] = array ( 'href' => $_SERVER['PHP_SELF'] . '?ajax=1&ID=' . $this -> _iProfileID .'&block=' . $iBlockID, 'dynamic' => true,'active' => ( $iBlockID == $iPageBlockID ), ); }
Then in profile.php I added after this
$_page['header'] = process_line_output( $p_arr['NickName'] ) . ": ". htmlspecialchars_adv( $p_arr['Headline'] ); $oPPV = new BxTemplProfileView($oProfile, $site, $dir);
### #If block is ajaxed if($_GET['ajax']){ $iBlockID = $_REQUEST['block'] ? $_REQUEST['block'] : 17; $iPFArea = 8; $oPF = new BxDolProfileFields( $iPFArea ); $aTemp= $oPPV->oProfileGen->showBlockPFBlock($iBlockID, '', $iBlockID, 1); foreach ($aTemp[1] as $key =>$value){ if ($value['active']){ $sCaption = _t($key); break; } }
$sTopCode = $this->_getBlockTopCode($iBlockID, $aBlock, $aTemp[1]);
echo DesignBoxContent($sCaption, $aTemp[0], 1 ,$sTopCode); exit; }
This displays what's seen in the screen shots. Because I want to only load that block, not the entire site when any of the menu options are selected.
http://www.mytikibar.com |
so the answer is.... ### #If block is ajaxed if($_GET['ajax']){ $iBlockID = $_REQUEST['block'] ? $_REQUEST['block'] : 17; $iPFArea = 8; $oPF = new BxDolProfileFields( $iPFArea ); $aTemp= $oPPV->oProfileGen->showBlockPFBlock($iBlockID, '', $iBlockID, 1); foreach ($aTemp[1] as $key =>$value){ if ($value['active']){ $sCaption = _t($key); break; } }
$sTopCode = $oPPV->_getBlockTopCode($_REQUEST['pageBlock'], $aBlock, $aTemp);
echo DesignBoxContent($sCaption, $aTemp[0], 1 ,$sTopCode); exit; }
instead of calling $this->_getBlockTopCode I had to use the object string $oPPV->_getBlockTopCode
http://www.mytikibar.com |
so the answer is....
### #If block is ajaxed if($_GET['ajax']){ $iBlockID = $_REQUEST['block'] ? $_REQUEST['block'] : 17; $iPFArea = 8; $oPF = new BxDolProfileFields( $iPFArea ); $aTemp= $oPPV->oProfileGen->showBlockPFBlock($iBlockID, '', $iBlockID, 1); foreach ($aTemp[1] as $key =>$value){ if ($value['active']){ $sCaption = _t($key); break; } }
$sTopCode = $oPPV->_getBlockTopCode($_REQUEST['pageBlock'], $aBlock, $aTemp);
echo DesignBoxContent($sCaption, $aTemp[0], 1 ,$sTopCode); exit; }
instead of calling $this->_getBlockTopCode I had to use the object string $oPPV->_getBlockTopCode
http://www.mytikibar.com |
If understand, you have it working now, Great! Geeks, making the world a better place |