I'm currently working on Smart Job Board script customization. Here is my thing:
I want to restrict a menu item for guest and job seaker I'm writing the follow script but its not working.
{if $GLOBALS.current_user.group.id != "JobSeeker"}
{if $GLOBALS.current_user.group.id != "Guest"}
<li><a href="{$GLOBALS.site_url}/search-resumes/" >[[Search Resumes]]</a></li>
{/if}
{/if}
Can any tell me where i'm going wrong ?
I forgot to check weather user logged in or not. The following code helped me to hide a menu item in
Smart-Job-Board
{if $GLOBALS.current_user.logged_in}
{if $GLOBALS.current_user.group.id != "JobSeeker"}
{if $GLOBALS.current_user.group.id != "Guest"}
<li><a href="{$GLOBALS.site_url}/search-resumes/" >[[Search Resumes]]</a></li>
{/if}
{/if}
{/if}
This helped me to hide a menu item.
Related
Shipping Method & Payment Method doesn't show at all but after I click Update Tools button it shows up. When I check the script it's called and loaded via AJAX.
Login to admin panel. Go to Sales > Orders > Click edit an order > Click Totals tab. Look at Order Details table below.
Here's a screenshot before I click Update Tools
And after I click on Update Tools
Here's the script which shows selectbox
<select name="payment">
<option value=""><?php echo $text_select; ?></option>
<?php if ($payment_code) { ?>
<option value="<?php echo $payment_code; ?>" selected="selected"><?php echo $payment_method; ?></option>
<?php } ?>
</select>
It seems $payment_code doesn't contain any loop that's why it doesn't seem to load all before I click the button.
The question is: Is it correct or is it a bug?
Did anyone ever take a look at payment and shipping method loading at all without clicking on "Update Tools" button?
I have compared with original script and the script is exactly the same.
Opencart Version: 1.5.6
It's correct, it shouldn't be a loop. $payment_code and $payment_method aren't arrays, they just contain one entry (the order's current payment method). Have a look at the getForm() method in the sale/order controller to confirm:
if (isset($this->request->post['payment_code'])) {
$this->data['payment_code'] = $this->request->post['payment_code'];
} elseif (!empty($order_info)) {
$this->data['payment_code'] = $order_info['payment_code'];
} else {
$this->data['payment_code'] = '';
}
This has been a headache a few times for some of my clients. I believe it's because it doesn't bother to calculate all relevant shipping methods in case you change the address. Ideally it should, and would recalculate when you change zone, but it doesn't, so... there ya go! Not a bug, just not ideal functionality.
I've got this code in my prestashop template, there is no loop, only conditional, and I get 5 back buttons (elseif section, first li tag), why is it happen?
{if $node.children|#count > 0 && ($smarty.get.controller!='product' && $smarty.get.controller!='category')}
<li class = "li-parent">
<asset class="menu-arrow-left"></asset>
<p><span>{$node.name|escape:'htmlall':'UTF-8'}</span></p>
{elseif $node.children|#count > 0 && ($smarty.get.controller=='product' || $smarty.get.controller=='category')}
<li class="li-back"><asset class="menu-arrow-right"></asset><p class="class="border-bottom-grandiet-small"><span>Back</span></p></li>
<li class = "li-parent">
<p><span>{$node.children[0].name|escape:'htmlall':'UTF-8'}</span></p>
{/if}
I don't see anything in this code that could cause displaying 5 back buttons. I suspect this code is included in some kind of loop and that's why it's displayed 5 times.
You should change the whole above code with:
testonly
and then look at page or page source and check how many testonly texts will appear.
It's also possible if you really use loop that you should use some extra condition. For example instead of:
<li class="li-back"><asset class="menu-arrow-right"></asset><p class="class="border-bottom-grandiet-small"><span>Back</span></p></li>
you should use
{if $node.children|#iteration eq 1}
<li class="li-back"><asset class="menu-arrow-right"></asset><p class="class="border-bottom-grandiet-small"><span>Back</span></p></li>
{/if}
and probably the rest should be more similar to the first condition so instead of:
<li class = "li-parent">
<p><span>{$node.children[0].name|escape:'htmlall':'UTF-8'}</span></p>
you should use:
<li class = "li-parent">
<p><span>{$node.name|escape:'htmlall':'UTF-8'}</span></p>
but it's really hard to say if we don't know what's the data structure and what exactly you want to achieve. If it still doesn't work you should provide more details to your question, explain what you want to achieve, what data you have in your variables and so on.
I got a code like this in joomla backend.
<td class="center"><?php echo JHtml::_('jgrid.published', $item->published, $i, 'products.', TRUE, 'cb'); ?></td>
The publish function work correctly sending me to my controller products and method publish. However, the unpublish was not correct it send me to publish method instead of unpublish method, even though the anchor tag still show correctly like this <a class="jgrid" href="javascript:void(0);" onclick="return listItemTask('cb7','products.unpublish')" title="Unpublish Item">
anyone got any idea about it?
This is a really really old question, but I just came across the same problem myself.
It looks like they are saving space by using the same method (which you pointed out) "publish" for both publish and unpublish functionality.
The problem is that in the method it checks how to set the state, but does so based on the "task" which for some reason does not strip the context of the controller out of the post data. So... instead of looking for...
if( $post['task'] == 'unpublish' ){
...you should be looking for...
public function publish(){
$post = JRequest::get('post');
if( $post['task'] == 'items.unpublish'){
$state = 0;
}else{
$state = 1;
}
Notice how the task we are looking for is items.unpublish (items being your controller) instead of just unpublish.
I know this is probably way to late, but hopefully it helps someone.
I am building a site in Expression Engine with a hard-coded navigation. I need to hide one of the nav items until the client makes an entry under a certain category, here's what I have right now:
{exp:channel:entries category_name="name" limit="1"}
{if count > 0}
<li> • Link</li>
{if:else}
(don't show anything)
{/if}
{/exp:channel:entries}
Any thoughts? Thanks!
yeah, exactly. If there is nothing there, it just won't show anything. If you needed to add a placeholder or something, you could use the {if no_results} tag.
I have a problem with outputting categories in to a list.
It seems to create another ul(one for the channel:categories) within the my ul, and also creates empty lists before each list.
I used the exact same code for entries and it worked fine.
Is this a categories problem?
Here is the Code:
<ul>
<li><a {if segment_2 == ""} class="selected" {/if} href="">News & Events</a></li>
{exp:channel:categories
channel="news_events"
disable="pagination|member_data|trackbacks"
dynamic="no"}
<li>{category_name}</li>
{/exp:channel:categories}
<li><a {if segment_2 == "gallery"} class="selected"{/if} href="">Image Gallery</a></li>
Any help would be appreciated!
With regard to the code output, take a look at the style parameter for the channel categories tag: http://ellislab.com/expressionengine/user-guide/modules/channel/categories.html#channel-categories-style. You'll want to change it to style="linear" to use your own markup.
As for the blank output, it's going to be tough to diagnose without seeing your install but try getting rid of dynamic="no".