w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Wordpress adding a news page with custom template loads wrong template
Create a php file inside your theme folder with the name 'page-news.php'. Copy the same code as your 'page.php' file inside page-news.php. This is the file that will be loaded when you enter http://www.website.be/news. Customize this file as you wish.

Categories : PHP

Eclipse - Java Template - static import - Template variable '' has incompatible types
This should work: ${imp:import(org.junit.Test)} ${impst:importStatic('org.hamcrest.MatcherAssert.*')} @Test public void ${testName}() throws Exception { ${cursor} } edit: If I recall correctly the first parts acts as the name variable and the second part is the type (import, var, ...). For example the following also won't work ${:newType(org.eclipse.swt.widgets.ExpandItem)} if (${:var(boolean)}) { ${cursor} } else { } You could remove imp or impst from my answer and it would also still work. In a template you can perform multiple actions on a variable, a good example is the List template. ${type:newType(org.eclipse.swt.widgets.List)} ${list:newName(org.eclipse.swt.widgets.List)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link('SWT.MU

Categories : Java

How to pass a template variable to a template helper function to preserve context?
The correct syntax would be : {{#if agentIs ../assigneeId}}selected{{/if}} The {{#each agents}} block helper introduces a new level in the template contexts tree (the new context corresponds to the current agent), this is why you need to "go back" from one level to properly reference the previous context where assigneeId resides.

Categories : Meteor

C++ - Template function with volatile variable - can't call the template specialization
template <long> static long testAndSet(volatile long &t, long value ) { #if defined(_PC) return InterlockedExchange(&t, value); #else return __sync_lock_test_and_set(&t, value); #endif }; That's not a specialization as you seem to think. It's an overload with a (unnamed) non-type template parameter. It'll never be selected during overload resolution for the call you made because you need to explicitly specify the parameter, like this for example: testAndSet<42>(counter, newValue);. The syntax you want is: template <> // <--- static long testAndSet<long>(volatile long &t, long value ) { // ^^^^^^ //.... } but at that point you could as well provide a normal overload. You should always prefer overloading, be

Categories : C++

safe for each variable in template =? autoescape off for whole template
Use the filter tag to apply a filter to a whole part of your template: https://docs.djangoproject.com/en/1.5/ref/templates/builtins/#filter

Categories : Python

How can I delay a reactive Meteor template from updating an HTML template variable, when a Meteor.call() updates the database instantly?
Try to wrap your Meteor.call() inside the setTimeout() itself, like: Template.keno.events({ 'click #start' : function(){ setTimeout(function(){ Meteor.call('process',function(){ //do something. }); }, 20000); } });

Categories : Meteor

Make a custom URL and link to custom Template
Could create post-types, team 1, team 2, team 3. Than create a single-team1.php and use that template file to list stuff that has to do with team 1. Example: <?php $args = array( 'post_type' => 'team1', '' => '', '' => '', '' => '', ); $team_one_stuff = new WP_Query( $args ); if ( $team_one_stuff -> have_posts() ) : while ( $team_one_stuff->have_posts() ) : $team_one_stuff -> the_post(); ?> <!-- Do WP stuff here --> <?php endwhile; else: ?> Wow, nothing assigned to team 1... o__O <?php endif; ?> You could pimp-up the metaboxes you use for team by using ACF. Realy easy to create new metaboxes for certain pages or post-types whith that plugin. Hope it helps. /Paul

Categories : PHP

TypeError using custom template tag
Well I do not why but markdown seems does not work inside a function in django for example I typed this in django shell (python manage.py shell): from markdown import markdown def yes(): return markdown("YES") and it gives me the next error: NameError: global name 'markdown' is not defined and this seems to work def yes(): from markdown import markdown return markdown("YES") outside django shell the first method works correctly hope this helps!

Categories : Django

Custom template injection in WPF
So far I've found the following, simple solution. In custom control XAML define the ListBox: <ListBox Name="_listBox"/> In code behind create a property: public DataTemplate ItemTemplate { get { return _listBox.ItemTemplate; } set { _listBox.ItemTemplate = value; } } In parent window or control set resources in XAML: <Window.Resources> <DataTemplate x:Key="CustomTemplate"> <TextBlock Text="{Binding Path=SomeProperty}"/> </DataTemplate> </Window.Resources> Then declare the custom control: <local:CustomControl ItemTemplate="{StaticResource CustomTemplate}"/> Now you need to have an interface that exposes SomeProperty and data source comprising of such interface instances that you need to set to _listBox.ItemsSourc

Categories : C#

Wordpress custom template issue
First Add a tamplate name in top of your page code: <?php /* * Template Name: About Page */ And so in the wordpress dashboard: pages -> your page -> click on quick edit and choose About Page template as your page template. Read more about Page Templates in wordpress codex: http://codex.wordpress.org/Page_Templates

Categories : PHP

Vb.NET - GetEnumerator on a Custom Template class
Well, mContenuto is a string, and you're trying to cast it into an IEnumerator(Of String), but the string class does not implement IEnumerator(Of String). That's what the exception is telling you. Your class seems to just hold two values (mKey, mContenuto), why do you want to implement IEnumerable<T> at all? It seems there's no need to this... You could nonetheless implement GetEnumerator like this: Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of TValue) Implements System.Collections.Generic.IEnumerable(Of TValue).GetEnumerator Return {Me.mContenuto}.AsEnumerable().GetEnumerator() End Function Private Function GetEnumerator1() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator Return GetEnumerator() En

Categories : Vb.Net

Wordpress Custom Taxonomy Template
There is a great post on the Wordpress stack exchange that addresses exactly this issue. The problem is that Wordpress uses a template hierarchy to load php templates based on the slugs of each term.

Categories : Wordpress

C++ custom template sort function
stable_sort is itself a template, the type of its third parameter is a template parameter. This means that you cannot pass a function template as the argument, because template argument deduction cannot apply here - there's nothing to tell which instantiation you'd be after. So you'd have to specify the template argument explicitly: stable_sort(data.begin(), data.end(), comp2<int, int>); However, you'll be better off if you provide a functor for that: struct comp2 { template <typename TElemA, typename TElemB> bool operator() (pair<TElemA, TElemB> const & a, pair<TElemA, TElemB> const & b) const { return a.first < b.first; } }; stable_sort(data.begin(), data.end(), comp2()); That way, the actual template argument deduction is postponed unt

Categories : C++

Finding which template a custom block is using
The template is page/template/links.phtml. Usually when a block does not have a template specified in the layout file, it's either a core/text block that does not use a template or the template is specified in the block constructor. If you take a look at Mage_Page_Block_Template_Links::_construct you should see this: protected function _construct() { $this->setTemplate('page/template/links.phtml'); } This is the template you are looking for. And other easy way would be to turn on the template path hints.

Categories : Magento

Custom template for platform add android
I don't know if you need this answer yet. But I was looking for something like it too today. And I found this link JIRA. So, I think you can edit "platform/android/AndroidManifest.xml" and Cordova will keep your code. But if you still need to custom AndroidManifest, I think that you will need to edit AndroidManifest template from Cordova. Regards,

Categories : Misc

How do I add a custom HtmlHelper to my NopCommerce template?
Any dlls in the theme folder will be ignored. You can still build them in your theme project, but you'll need to drop them into the Nop.Web/bin folder so they get loaded. So: how do I add the custom helper to my theme/template? Just like you have it--create an extenstion method against HtmlHelper directly in your theme project. where does the build output go (so NopCommerce can load it)? Move the theme dll to Nop.Web/bin--i.e. the bin directory at the root of your website. how do I refer to the helper from my view? Just like you have it. Add a using statement, and then use the helper: @using Nop.Theme.Foo.Helpers; ... @Html.Test() Oh, and if you want to resolve an instance of something inside your static helper, you can use this: using Nop.Core.Infrastructure; // ... var whate

Categories : Asp Net Mvc

Add variable to each twig template
You do that by using global variables. How to Inject Variables into all Templates (i.e. Global Variables) (I know, searching the docs is hard...)

Categories : Symfony2

Insert Variable in Template
With crispy_forms, you can specify a template to use to render a field. forms.py ... Field("medical_record_number", template='your_app/uni_form/display_mrn_field.html'), ... display_mrn_field.html <div class="span3">MRN: {{ field.value }}</div> That's it, it will now render that html instead of a normal input.

Categories : Django

Django: custom template tag recursive called
Django only executes the __init__ when "building" the template, when rendering only render() is called. Therefore you need this fiddling using template variables, when doing something like self.position = template.Variable(self.position) you tell Django only that self.position is a variable defined in the template's context, but not its value; to get the value you need to resolve it when rendering: def render(self, context): position = self.position.resolve(context) # do something with position...

Categories : Django

Create and run custom T4 template with input parameters?
You use partial classes to add parameters to the template. This article can get you started. The idea is that having the following template named MyTemplate.tt : <table> <# for (int i = 1; i <= 10; i++) { #> <tr><td>Test name <#= i #> </td> <td>Test value <#= i * i #> </td> </tr> <# } #> </table> Then you can add a partial class in a separated file, for example MyTemplateExtension.cs, where you can set your own properties: partial class MyTemplate { private MyData m_data; public MyTemplate(MyData data) { this.m_data = data; } } And use those properties in the template: <h2>Sales figures</h2> <table> <# foreach (MyDataItem item in m_data.Items)

Categories : Asp Net

How to use custom repository methods in Twig template?
It's best if you make a relationship from User to Books. Assuming you have made this relationship you can make your query like this: public function getBooksOwnedByUser($user_id) { return $em->createQuery('SELECT u, b FROM MyBundleEntityUser u JOIN u.books b WHERE u.id = :user_id') ->setParameter('user_id', $user_id) ->getResult(); } Then in your controller: $em = $this->getDoctrine()->getManager(); $user_with_books = $em->getRepository('MyBundleEntityUser') ->getBooksOwnedByUser($user->getId()); return $this->render('YourTemplate.html.twig', array( 'user_with_books' => $user_with_books, )); In twig: {% fo

Categories : Symfony2

asp.net mvc custom template for application forms and page
Editor/Display templates They are mostly used for edit/display forms such as editing/displaying user profile data form, etc. Kind of like your Non-Grid Template. You can create Object templates, place them in the corresponding folders of the solution and they will be automatically every time you render your model via Html.EditorForModel() or Html.DisplayForModel helpers. Here is a good article to start with ASP.NET MVC 2 Templates, Part 4: Custom Object Templates Shared views I'm not sure what your Process template looks like but it seems it's a fixed number column grid like a one column with chackboxes and one more column with names of the items to process. In this case you'd better create an interface and a shared view. Then you can use the interface to map your view model to and rende

Categories : Asp Net Mvc

What Rails cms supports custom template container?
Not sure what approach is more suitable for you but ComfortableMexicanSofa can do things like that: https://github.com/comfy/comfortable-mexican-sofa Take a look at the wiki specifically mirroring functionality.

Categories : Ruby On Rails

ASP MVC 4, passing data in custom editor template
@Html.Partial("~/Views/Shared/EditorTemplates/CustomDropdown.cshtml", CustomerCountrySelectionList) And the models goes straight into the view. @Html.Editor(), despite having 6 overloads, probably have none of them designed to pass a model inside the custom editor.

Categories : C#

WPF template overridden when custom style applied
You have to base the new style on the existing default style: <ComboBox.Style> <Style TargetType="ComboBox" BasedOn="{StaticResource ResourceKey={x:Type ComboBox}}"> ... </Style> </ComboBox.Style> By the way, it is not necessary to set the key of the default style in the resource dictionary in App.xaml. If you specify TargetType="ComboBox" the key is set to that type by default. So this is sufficient: <Style TargetType="ComboBox"> ... </Style>

Categories : Wpf

Formatting template with custom form parameters
Best way to go is probably writing your own templatetag for your forms. template.html {% load yourapp_tags %} {{ form|as_table }} yourapp_tags.py from django import template register = template.Library() @register.filter def as_table(value): #do the formatting return value For docs on how to use your own templatetags, take a look here.

Categories : Django

Need to include a custom template page through a plugin
It's not in the documentation because WordPress doesn't look elsewhere. Your best bet would be to create a template page in your theme folder, call it what you want, and then use include() to pull the contents of your template file in the plugins directory into the file in your theme directory, which would allow WordPress to see it. I think the only other way to accomplish this would be to mess with Core, which is very bad practice.

Categories : PHP

Custom FOSUserBundle Login Template using Bootstrap
You were almost there :) you can include the login form in any other template using the render function. {% render controller("FOSUserBundle:Security:login") %} ... you just have to create app/Resources/FOSUserBundle/views/Security/login.html.twig and ommit the wrapping {% block fos_user_content %} found in FOSUserBundle's login.html.twig in order to have it return the form directly: {% if error %} <div>{{ error|trans }}</div> {% endif %} <form action="{{ path("fos_user_security_check") }}" method="post"> <input type="hidden" name="_csrf_token" value="{{ csrf_token }}" /> <label for="username">{{ 'security.login.username'|trans }}</label> <input type="text" id="username" name="_username" value="{{ last_username }}" required="req

Categories : Symfony2

Custom control's properties not changing when used in a template
The parent of your ControlTemplate needs to have something for your CustomControl to bind to. Then, you bind the CustomControl in your template to the parent. In the following example, I'm using a Border to template a Button, which binds its BorderBrush to the Button's Background: <ControlTemplate TargetType="{x:Type Button}"> <Border BorderBrush="{TemplateBinding Background}" /> </ControlTemplate> Replace Button with your "large composite control" and Border with my:CustomControl and you should be set...

Categories : Wpf

Change binding value in custom template trigger
Because you set Foreground to a fixed value, according to Dependency Property Setting Precedence List, your style trigger will not override this value. You need to bring Foreground set into Style as another setter like this: <Style x:Key="CustomButtonStyle" TargetType="{x:Type Button}"> <Setter Property="Foreground" Value="White"/> ... </Style>

Categories : Wpf

Wordpress Custom Taxonomy Template file
See WordPress' template hierarchy documentation. You must create a file called taxonomy-ebookgenre.php in your theme directory (or have one of taxonomy.php, archive.php, or index.php files). Also, you should go to the WordPress Admin > Settings > Permalinks page. Simple visit the page, and WordPress will regenerate your rewrite rules. Your taxonomy will not work until you do this first. This is due to WordPress caching URL rewrite rules, so if you added your taxonomy after these were cached, the URLs won't work. Whenever you visit the permalink settings page, the rewrite rules are flushed and re-cached.

Categories : Wordpress

How do I Create a Custom Template File in Wordpress?
You just have to put some comment like on the top of your file : /* Template Name: My Template */ You can find more informations here : How to create a custom template

Categories : PHP

Display Custom Post template name in wordpress
You should take a look at get_page_template. A side not you are including css wrong. You should not use <link> to include styles but you should use wp_enqueue_style, this allows stuff like caching and minify. Roughly the same goes for javascript which has wp_enqueue_script A good tutorial about it: http://halfelf.org/2012/jquery-why-u-no-enqueued/

Categories : Wordpress

How to access custom project properties from a T4 template?
Sure you can have the msbuild file set an environment variable which can then be pulled in via T4. Also Use MSBuild Properties in T4 Templates there's a command-line way to do it.

Categories : Misc

Custom Post Meta Search Template
You checking incorrect variable in if so try removing that one, query_posts('meta_value='.$s); while ( have_posts() ) : the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile;

Categories : PHP

Displaying Custom Content On Different Pages All Using The Same Template
using a content-box.php would probably be your best bet and inside it - target the pages by name. inside of the content-box.php: <?php if(is_page('accommodation')) {//show accommodation box}?> <?php elseif(is_page('restaurant')) {//show restaurant box }?> etc.

Categories : PHP

How does this variable passed into template in Django?
It is passed because you are using RequestContext() to pass some default context variables. One of them is user passed by auth context processor. RequestContext() is used, passes some default context variables. More details of Requestcontext is here.

Categories : Python

Valid variable name in Template Toolkit
Generally, a valid perl variable is a valid template toolkit variable. The variable should always start with a non numeric, non symbolic character [ A to Z and _ ] Variable can only contain a to z, 0 to 9 and _ (underscore) characters. Variable names cannot contain special symbols (it includes '-' symbol ). Eg: $user-name is not a valid perl variable. but $user_name is valid. Here is what perl interpreter throws for your code $ my $user = { user-name => "John" }; Compile error: Bareword "user" not allowed while "strict subs" in use at (eval 294) line 5. If you really want to use 'user-name' then you should define like this $ my $user = { "user-name" => "John" }; $ my

Categories : Perl

How to call template with name as a variable in XSLT?
I think it is not possible to choose name of template to be called dynamically. What could be done is xsl:choose utilization (perhaps with combination with mode attribute), like this <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/root"> <html> <xsl:for-each select="c/c1"> <xsl:choose> <xsl:when test="text = 'US'"> <xsl:apply-templates select="text" mode="US"/> </xsl:when> <xsl:when test="text = 'UK'"> <xsl:ap

Categories : HTML

applying template using variable in XSLT
If you have a variable of type string and you want to compare it then reference it with $varname but don't put it inside of string literal delimiters. So use <xsl:apply-templates select="module[@name = $module]/categorys"/> to apply templates to the categorys child elements of those module elements where the name attribute has the value C.

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.