After searching without much luck, both here in the forums and out in google world, I am asking for some guidance on writing a bx_if to hide/show a section in the _subheader.html. I need to hide a section if a guest is viewing the page and then show it once a member logs in. Where do I need to put my bx_if so it is available to the _subheader.html. I don't know why such a global bx_if does not exist already but I did not see one when searching the code.
We could have <bx_if:guest_hide>
Also, what is the form for this? I am seeing this for a Boonex bx_if
'bx_if:show_empty' => array( 'condition' => $sProfStatusMessage == '' && $sSubmenu == '', 'content' => array( 'content' => '' ) ),
Geeks, making the world a better place |
Also, what is the form for this? I am seeing this for a Boonex bx_if
'bx_if:show_empty' => array( 'condition' => $sProfStatusMessage == '' && $sSubmenu == '', 'content' => array( 'content' => '' ) ),
Those are normally used in modules.
Basically 'condition' => $sProfStatusMessage == '' && $sSubmenu == '', could be this. This will be easier to understand.
'condition' => true then the content of the bx:if section will be shown. Otherwise if 'condition' => false than the code will not be shown.
So for your condition it would be 'condition' => !ifLogged(),
https://www.deanbassett.com |
This is something that I actually did, but not exactly like you needed. On the browse.php page, I needed to add a search parameter for whether or not a client was referred from another doctor and show this referral info if they are. I will just put what I did, and hope it leads you in the correct direction.
On my .html page, I added:
<bx_if:referral_yes> Referred By: __ReferralSource__ For: __ReferralReason__<br> </bx_if:referral_yes>
I have to find the page i used the php code on to define whether a person is referred or not. Will post when I do find it.
caredesign.net |
Either I am not using the correct condition, or I am not putting the bx_if in the correct place to be picked up by the _sub_header.html.
I am going to have to go to bed and wait; I needed to get this done tonight but it is getting way too late. If it was a page block or a menu item, I could just use the built in controls to hide from guest; however, it is not so those controls are useless.
Geeks, making the world a better place |
Well as i mentioned. <bx:if sections are normally used in modules where the array variables can be passed to the html template. But in your case your trying to do it in the main templates which are not setup to process those as there is currently no way to pass the condition array to the parser.
I'll see if i can find a way to do this.
https://www.deanbassett.com |
Injections?
Well as i mentioned. <bx:if sections are normally used in modules where the array variables can be passed to the html template. But in your case your trying to do it in the main templates which are not setup to process those as there is currently no way to pass the condition array to the parser.
I'll see if i can find a way to do this.
so much to do.... |
The extra top menu is using bx_if, see extra_top_menu.html. However, I guess the sub header is not set up for it.
Maybe I need to create a key to hold the contents of the section and check for one of the conditions that indicates a guest is viewing the page. Then I add in display:none to the section.
Geeks, making the world a better place |
Injections?
Well as i mentioned. <bx:if sections are normally used in modules where the array variables can be passed to the html template. But in your case your trying to do it in the main templates which are not setup to process those as there is currently no way to pass the condition array to the parser.
I'll see if i can find a way to do this.
I do have Deano's Head Injections. Javascript to change the display: setting of the style? Read the session cookie? I think the key idea might be better; it would do it on the server before sending it to the browser. I prefer to do such things server side instead of client side. All the person would have to do is turn off javascript to see the content of the section.
Geeks, making the world a better place |
Or, why not just create my own template for this. Move that out from the sub header and add it separately and write a function to handle it and send it to the template parser. Geeks, making the world a better place |
head injection not gonna do it, you have to get into database and add an entry for the correct key in "sys_injections" table. You need to get the key name from the sub_header.html file. so much to do.... |
Here is my solution. I first added the "THING"; a block of code, to the _sub_header.html, back when; over a year ago, when I did not know anything; still don't know a lot LOL, about Dolphin and how things work. I did not do it the proper way of course but it worked at the time and if one needs to add something quick and easy, it is OK. However, the problem has now come about where we don't want guests to see this "THING".
Now for the solution.
In BxDolTemplete I added a case for my key:
case 'thing': $iProfileId = getLoggedId();
if ($iProfileId) { $sRet = $GLOBALS['oFunctions']->genThing(); } break;
and in BxBaseFunctions I add the function to generate Thing.
function genThing() { $Thing = <<<EOT Thing EOT; return $Thing; }
Finally in _sub_header.html I add the key for thing
__thing__
If there is a better way or I am not really doing something correctly, let me know.
Geeks, making the world a better place |