Smarty template variable carry to header.tpl - variables

Editing the WHMCS template files (smarty) I can't seem to carry this variable outside of its tpl page and into the header.
knowledgebase.tpl
{assign var="page_alias" value="knowledgebase"}
header.tpl
{assign var="active_link" value="my value"}
{if isset($page_alias) && $page_alias == 'knowledgebase'}
{$active_link}
{else}
{}
{/if}
If all that is on the same page it outputs "my value". but when I have it setup on pages as described above it returns nothing. I've also tried the scope='global' at the end of the first code.
I see several people with similar questions on here but none seem to have an actual answer.

Use session instead. I had the similar problem. Couldn't find any solution. Even contacting WHMCS support did not help! So I just used session variables to handle my job.

Related

A question about Vue.js source code in function _createElement()

In _createElement, I want to ask whether data.is is same to the v-bind:is?
https://github.com/vuejs/vue/blob/0baa129d4cad44cf1847b0eaf07e95d4c71ab494/src/core/vdom/create-element.js#L64
Why tag = data.is?
Thanks for every respondent!
As the comment in the code suggests, that line is specifically to handle the case where is is included inside an object v-bind. e.g.:
<component v-bind="{ is: 'button' }">Button</component>
You can see this for yourself by setting a breakpoint in your browser on that line. I'm using Webpack and Chrome and the relevant file appears under webpack:///./node_modules/vue/dist/vue.esm.js in the Sources tab. Quick search for _createElement and click in the margin to set a breakpoint.
In the example above the is value is intended to be used as the tag, whereas component is just a dummy tag that can be discarded.
The syntax above is equivalent to:
<component is="button">Button</component>
or:
<button>Button</button>
However, neither of these two examples will go into the relevant if section. In these other two cases the tag is already resolved correctly prior to this point.

Remove "Social Title" from order form in Prestashop?

I have just downloaded and installed the latest version of Prestashop. And found out there is a Social Title-option in order checkout form.
I want to remove that. I have found how to remove the Mr and Mrs boxes. But the whole row and label "Social Title" remains.
Have tried to search on Google for an answer but can't find. Some answers refer to the addresses.tpl. But I think the templates might been changed since these threads.
In fact, I have tried to search for "social" in the whole template directory and can't find anything related to this.
The nearest I get is in the ../templates/customer/_partials/customer-form.tpl. And I think it's rendered where this is:
<section>
{block "form_fields"}
{foreach from=$formFields item="field"}
{block "form_field"}
{form_field field=$field}
{/block}
{/foreach}
{/block}
</section>
So, maybe the social title isn't able to change from templates anymore?
So, where do I change it nowadays?
In Prestashop 1.7 there is no need to edit any code, you can just go to Shop Parameters -> Customer Settings -> Titles and remove all existing titles.
This will prevent the "Social title" field from being generated.
Shop Parameters -> Customer Settings -> Titles - Delete titles
themes/xxx/templates/_partials/form-fields.tpl 9th line change
{if $field.type !== 'checkbox'}
{$field.label}
{/if}
to
{if $field.type !== 'checkbox' and $field.type !== 'radio-buttons'}
{$field.label}
{/if}
Yeah, it's kind of dummy workaround, but it works.
UPDATE:
More proper way would be to comment the block:
$genderField = (new FormField)
->setName('id_gender')
->setType('radio-buttons')
->setLabel(
$this->translator->trans(
'Social title', [], 'Shop.Forms.Labels'
)
)
;
foreach (Gender::getGenders($this->language->id) as $gender) {
$genderField->addAvailableValue($gender->id, $gender->name);
}
$format[$genderField->getName()] = $genderField;
You can find it in /classes/form/CustomerFormatter.php
You can find the code for Social Titles in file at the following path:
/themes/default-bootstrap/identity.tpl
Note: It is not a good practice to remove the code from a core file, we recommend to apply some CSS to hide the Social Title block.

How to set the default value of input item with jQuery EasyUI framework

I am trying to set the default value of an input item from last two days.
For this, i have also searched in google but till not cannot find the solution.
I am using jQuery EasyUI framework.
<div class="fitem">
<tr>
<td></td>
<td>
<input type="text" class="easyui-validatebox" name="insertby" id="insertby" size="20">
</td>
</tr>
</div>
<script>
var s = '<?php echo $logname; ?>';
document.getElementById('insertby').value = s ;
alert(s);
</script>
As I am unable to add a comment to ask you to try stuff, I will try my best to help you out!
Firstly, your code works for me. However, there are times where other javascript codes causes errors and stops the code execution before your block of code. You might want to try pressing F12 on your Chrome browser to see if you encounter any errors before your block of code to ensure that all is well.
this code snip might have you
http://www.jeasyui.com/forum/index.php?topic=2623.0
$('#insertby').validatebox('setValue', s);
I took me while to "get it" too.
Actually, jquery easyUI modifies the DOM on the fly to make its fancy things in a way that the original input box is "gone" while you obtain their fancy widget instead. That's why modifying the input field directly has no effect, it is hidden actually. I guess this is done so because their getters/setters should be used in order to update everything correctly.
EasyUI is very easy to set up and play with, but it's way to operate on elements is rather unintuitive. But once you got the hang of it, it should be all right.
Use
setValue. $('idofcombogrid').('setValue',id_value);
The id_value refers to the value of idField as defined initially for the combogrid.

whmcs title code how i can modified?

my whmcs title code show beleow. i want to modified it.
<title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title>
i want when i go my site homepage/index page then show this code like that
<title>{$companyname} - {$pagetitle}</title>
but when i go other page like shared hosting,reseller hosting etc then code show that
<title>{$pagetitle} - {$companyname}</title>
how i can do it. it possible?
You Should Some Modified Mr Caner G code. like this. i think it will be work.
<title>{if $filename eq "index"}{$companyname} - {$pagetitle}
{else}{$pagetitle} - {$companyname}{/if}</title>
In your templates, find header.tpl, use the following code :
{if $filename eq "index"}
<title>{$companyname} - {$pagetitle}</title>
{else}
<title>{$pagetitle} - {$companyname}</title>
{/if}
Yes it is possible. Please check the following offical document of WHMCS(Page titles section) : http://docs.whmcs.com/Seo
Alternatively you could use the template var {$isIndex}.
Like so
<title>
{if $isIndex}
{$companyname} - {$pagetitle}
{else}
{$pagetitle} - {$companyname}
{/if}
</title>
When in doubt about what template vars are available to you in WHMCS you can always use the {debug} command

How to get an article description or excerpt within Expression Engine

I saw in Expression Engine I can use {embed:title} and {site_name} variables, but now I need a variable to pull an excerpt or description of the article itself. Is there such a variable/tag?
ExpressionEngine tags are based solely on custom fields which you yourself have defined. So in the field group for your "articles" channel, you'll have some fields, maybe {article_summary}, {article_body}, {article_image}, etc. To display your summary, just use {article_summary} in your template.
I'm assuming that you're coming from something like WordPress maybe, where every piece of content has the_content() and the_excerpt() ... aside from a handful of global variables, and some fields which are universal to all entries (like {title}, {entry_date}, etc), ExpressionEngine isn't like that. You define what fields you use for each channel - you have complete control.
Here is the actual code you have to include in your EE template.
{exp:channel:entries channel="article" limit="5" dynamic="no"}
<div class="home_thumb">
<h1>{title}</h1>
<div class="home_thumb_img">
<img src="{article_image}">
{if article_content}
<p>{article_content}</p>
{/if}
</div>
</div>
{/exp:channel:entries}