Issue What are some good templating engines for web designers? I definitely have my preferences as to what I’d prefer to work with as a programmer. But web designers seem to have a different way of thinking about things and
Continue readingTag: templating
Silverlight Control Template Color Property
Issue I am creating a Control Template for the Button control in Silverlight 2. I started with an empty template and added the visual elements I wanted. The main visual element is just a path (shape) filled with a color.
Continue readingUsing ASP.NET usercontrols for templating without having a Website project?
Issue Is there a way of using ASP.NET user-controls (.ascx files) to fill my own templating needs within a .NET application, without that application being a Website? It’s actually a class library that will take data in, combine it with
Continue readingJohn Resigs micro templating engine, question of how to handle selects?
Issue I’ve a template that looks like so: <script type=”text/html” id=”TemplateEdit”> <td> <input type=”hidden” value=”<#= item.ID #>” id=”Edit.ID” name=”Edit.ID” /> <select id=”Edit_ClientID” name=”Edit.ClientID”> <option value=”1″>test</option> <option value=”2″>test 2</option> <option value=”3″>test 3</option> </select> </td> <td> <select id=”Edit_Frequency” name=”Edit.Frequency”> <option value=”1″>Daily</option> <option
Continue readingDoes anyone use ASP.net (webforms) to dynamically generate javascript and/or css files?
Issue I prefer the use of external css and javascript files. There are however many cases where the content of a javascript or css file needs to be dynamic. I’ll usually just transfer the javascript or css to inline or
Continue readingDatabase calls in Smarty/views/templates
Issue Today at work someone tried to convince me that: {$obj->getTableInfo()} is fine for smarty/mvc/templating because it is using an objects method. I argued that because it makes a call to the database it has no place being there and
Continue readingwhat templating engine options are there for PHP?
Issue I wonder what options there are for templating in PHP? If the templating code can be very similar to PHP, it’d be best. Solution I can recommend Smarty The template is a plain HTML with some extra markup for
Continue readingWhich Java templating system should I use to generate emails?
Issue I have a website that uses JSP as its view technology (and Spring MVC underneath). Unfortunately, JSP is just a pain to use for anything that doesn’t involve an HTTP session. I would like to be able to occasionally
Continue readingTwo concepts from XSLT in other languages: apply-templates and xpath
Issue Background: Having given up on the practical daily use of XSLT as a part of my programming toolkit, I was wondering if there were any implementations in other languages of the (only) two things I miss about that tool:
Continue readingStaticResource in Silverlight ControlTemplate?
Issue I’m trying to use a StaticResource in a ControlTemplate for a custom object, and whenever that object is rendered, the application crashes. As you can see in the code below, I define both the template and the resource in
Continue readingRegex: faulty syntax used with preg_replace_callback?
Issue I have borrowed code from this link PHP regex templating – find all occurrences of {{var}} to implement a means of applying values to template fiies. This uses the preg_replace_callback() function my preferred method of naming is name1.name2.name3=value, rather
Continue readingdjango generic templates
Issue So, Generic views are pretty cool, but what I’m interested in is something that’s a generic template. so for example, I can give it an object and it’ll just tostring it for me. or if I give it a
Continue readingWPF templating/styling issue
Issue Given this piece of XAML <DockPanel> <DockPanel.Resources> <Style TargetType=”{x:Type GroupBox}”> <Setter Property=”Template”> <Setter.Value> <ControlTemplate TargetType=”{x:Type GroupBox}”> <DockPanel> <Border DockPanel.Dock=”Top”> <Border.Resources> <Style TargetType=”{x:Type TextBlock}”> <Setter Property=”Foreground” Value=”Red” /> </Style> </Border.Resources> <ContentPresenter ContentSource=”Header” /> </Border> <ContentPresenter /> </DockPanel> </ControlTemplate> </Setter.Value> </Setter>
Continue readingGood practices for writing HTML in Javascript
Issue I was wondering about this if people have strong opinions about the best way to generate HTML on the fly, especially with Ajax based applications. Do you just create the HTML code using server side scripting and then send
Continue readingPython: Need to replace a series of different substrings in HTML template with additional HTML or database results
Issue Situation: I am writing a basic templating system in Python/mod_python that reads in a main HTML template and replaces instances of “:value:” throughout the document with additional HTML or db results and then returns it as a view to
Continue readingTemplating Html.DisplayFor() in ASP.NET MVC 2
Issue It appears that if you just use Html.DisplayFor(model => model) with no templates for a Details view, the resulting markup will look something like this: <div class=”display-label”>first name</div> <div class=”display-field”>Dan</div> <div class=”display-label”>last name</div> <div class=”display-field”>M</div> <div class=”display-label”>email</div> <div class=”display-field”>danm@fakedomain.com</div>
Continue readingDjango: using variables as array indices?
Issue I am trying to create a template that will put items in a table. Controller: items = Item.all().order(‘name’).fetch(10) template_values = {‘items’: items, ‘headers’: [‘Name’, ‘Price’, ‘Quantity’]} render(‘Views/table.html’, self, template_values) Template: <table> <tr> {% for header in headers %} <th>{{header}}</th>
Continue readingText transforms on all of objects properties, is there a better way?
Issue Currently I am doing this: I have text that looks like: Hello ${user.name}, this is …. And I do this: public string TransformUser(User user, string text) { StringBuilder sb = new StringBuilder(text); sb.Replace(“${user.name}”, user.Name); … … return sb.ToString(); }
Continue readingMake object available within php functions without passing them or making them global
Issue This requirement is just for simplicity for developers and beautiful code. I’m building a template system and I really would just like an object variable to simply be there in all functions. Here’s some code: Librarian.php: $class = “slideshow”;
Continue readingCan a python view template be made to be 'safe/secure' if I make it user editable?
Issue Say I need to have a templating system where a user can edit it online using an online editor. So they can put if tags, looping tags etc., but ONLY for specific objects that I want to inject into
Continue readingConditional Styling In Silverlight?
Issue While I’m fine with standard control styling in silverlight I have recently began using more dynamic methods of fetching data to be displayed in items controls. One of the controls I am reworking is a collection of links. The
Continue readingFrontend Intertag Communication
Issue I’ve had a question that I’ve been wondering for a while. I’m making a templating system for front-ends where tags are interpretted (like Smarty). I was wondering if there is value in having the tags be able to communicate
Continue readingHow do I get some string values from Pylons controller be assigned to JavaScript variables with Mako?
Issue I’m developing under Pylons using Mako templates. The problem is that I need to assign a string from some attribute of tmpl_context to a JavaScript variable in a page body. The additional problem is that this string can be
Continue readingHow does one make a template system (like Tumblr's) in Rails?
Issue I’ve looked at Liquid and the like, but I cannot find a way to make a “one file” template that can handle all situations. I don’t want to reinvent the wheel, but I will if I cannot find an
Continue readingSmarty templates uploaded during high trafficked site causes blank page
Issue I work on a very high trafficked website that uses a Smarty templating system. When I upload a fresh copy of a template that is currently being used, the page turns blank (as if there is nothing in the
Continue readingusing chain.js for complex templates and images?
Issue I’m researching the possible use of the jquery plugin chain.js over other templating systems such as jTemplate. the site is a large online retailer. We have a category page showing a large list of products, dresses for example. A
Continue readingIs there a reason I should be dissuaded from using an alternative templating engine in my Django app?
Issue I’ve done a few small-ish Django projects, and each time I’ve been struck by the apparent limitations of Django’s templating language. Just as a random example, I was shocked to learn that if, in the context of a template,
Continue reading.Net templating engine with object graph output, not string
Issue I would like to know if there’s any templating engine that is used for object graph creation? There are many to create HTML or other string resulting content. But I would like a templating engine that spits out objects.
Continue readingPython dictionaries, find similarities
Issue I have a python dictionary with a thousand items. Each item is, itself, a dictionary. I’m looking for a clean and elegant way to parse through each item, and find & create templates. Here’s a simplified example of the
Continue readingClient side template library for mootools?
Issue I am using mootools for my project. Any recommendations for client side template library that plays well with mootools? Solution Finally I tried mustache.js and it just worked fine. So I just decided to stick with it. @digitaraid Thanks
Continue readingusing a loop in a template
Issue I started writing my own small scaled framework and i have gotten to the templating part of it. So far i have been able to do simple variable replacing with the following code: public function view($page, $vars) { if(!file_exists(‘system/views/’
Continue readingHow can I put something like this in a Smarty template?
Issue I am trying to convert a pre-existing site that had html and php intermingled into a Smarty template based site. I never used Smarty before so this is proving very difficult for me. I get that you can assign
Continue readingClient side templates and partial views and express
Issue We have a large amount of client side templating solutions recently including: jquery templates John resig micro templating handle bars EJS and more As far as I can see only jQuery templates support the concept of partials templates (in
Continue readingWhy don't I just build the whole web app in Javascript and Javascript HTML Templates?
Issue I’m getting to the point on an app where I need to start caching things, and it got me thinking… In some parts of the app, I render table rows (jqGrid, slickgrid, etc.) or fancy div rows (like in
Continue readingTemplating in php, without using a templating engine
Issue Something in PHP, I want to display content if a certain variable exists. For example, For the current comment I want to check if the author has already voted on this reply, so the code will be something as
Continue readingcodeigniter display a random record from DB every page load
Issue I have a query that gets one random record from a database table and saves it in, $banner_text I am having trouble showing that banner text in my template though. Below is my code for MY_Controller which all my
Continue readingControlTemplate for ScrollBar apply only to DataGrid
Issue Hello I have a ScrollBar Template as per below – only relevant portion shown: <ControlTemplate x:Key=”VerticalScrollBar” TargetType=”{x:Type ScrollBar}”> <Grid> <Grid.RowDefinitions> <RowDefinition MaxHeight=”18″/> <RowDefinition Height=”0.00001*”/> <RowDefinition MaxHeight=”18″/> </Grid.RowDefinitions> <Rectangle Height=”35″ Width=”19″ Fill=”{StaticResource GreenTeaBrush}” Margin=”-35″ VerticalAlignment=”Top”/> <Border…. Now the Rectangle Portion:
Continue readingCMS permalink and templating system how to?
Issue I want to understand how to use templating system and permalinks on php websites 😀 !.. let me describe my self more, 1.currently i have 20 files each have its own php logic (index.php,wizard.php,search.php etc) ALL use same class’s
Continue readingRemoving an item from a generic Dictionary?
Issue I have this: public static void Remove<T>(string controlID) where T: new() { Logger.InfoFormat(“Removing control {0}”, controlID); T states = RadControlStates.GetStates<T>(); //Not correct. (states as SerializableDictionary<string, object>).Remove(controlID); RadControlStates.SetStates<T>(states); } states will always be a SerializableDictionary with string keys. The values’
Continue readingwhy is it faster to put ressources in my APP.xaml rather than in MyClass.xaml in WPF?
Issue here’s the thing: I have a project in which my menus/ContextMenu/MenuItems are templated. so basically I have a MyMenuItem.xaml/MyMenuItem.xaml.cs file couple with my MyMenuItem.xaml file containing some resources + style and template. problem: my contextMenu (quite huge I admit,
Continue readingUsing html files as templates in happstack
Issue I can find plenty of documentation on using blitz and other compiletime templating libraries with happstack but I would like to know how to use html files as templates. Solution Though there are many options, my favourite would be
Continue readingPutting your HTML files in the /public directory?
Issue Is there anything inherently wrong with putting HTML files in the internet-facing public folder? Is there security issues with this approach? Can’t you just view source anyways? Do we have our views outside the public folder purely for templating
Continue readingHow can I change a control's style just for one part of my app in WPF when the control's Type has a global Style?
Issue I have styled my Menu/ContextMenu/MenuItem controls in App.xaml so that those styles apply to all my app. defined like this (e.g. with the MenuItem): <Style TargetType=”{x:Type MenuItem}”> <Setter Property=”SnapsToDevicePixels” Value=”true”/> <Setter Property=”OverridesDefaultStyle” Value=”True”/> <!– more setters –> </Style> this
Continue readingjade outputs relative links
Issue I’m starting to play with node, express and jade and when I do this a(href=”http:/www.example.com/” + variable) variable I get a relative link, say <a href=”http://127.0.0.1:3000/www.example.com/mytext”>mytext</a> Instead of the absolute link. I’m guessing I’m doing something wrong with the
Continue readingCreating a Blank Rails 3.1 Templating Handler
Issue What I want to do is make it just output the view itself, and ignore what Rails would normally think is embedded Ruby within the HTML. For example: <div class=”current”> <div class=”question”> <h3 id=”homework_name”><%= homework.name %><h3 id=”due”>Due <%= homework.due
Continue readingChange font size of a GridView's ColumnHeader
Issue Is there an easy way to change header font size without overwriting completely duplicating ColumnHeaderTemplate? Note: Not sure if it is relevant, but I use an application theme (PresentationFramework.Royale) which provides the ColumnHeaderTemplate. Solution If you aren’t also applying
Continue readingHow to use auto_import feature with FreeMarker and maven or ant (not servlet)
Issue I’d like to test using freemarker to automatically build my html files at compile time (not use the servlet) and want to use the auto_import feature so I don’t have to re define the template for each file. I
Continue readingWhere should I use templating, and where should I generate view objects programmatically?
Issue I am using Backbone.js for an applciation involving a lot of different views, some nesting other views, and these other views could further nest other views. Also view presentation depends on certain attributes in the model, for instance, some
Continue readingError using Mason as stand-alone templating language
Issue G’day, I’m trying to use HTML::Mason 1.35 as a stand-alone templating language to generate emails. Consider the following test script: #!/usr/bin/perl use strict; use warnings; use HTML::Mason::Compiler; use HTML::Mason; use Data::Dumper; my $view_info = { name => ‘John Smith’,
Continue readingChanging WordPress Page / Post Markup
Issue I am currently tying to convert a HTML template to a WordPress theme. We need to assign two classes to the existing <h1> tag, which currently has a class of entry-title. We would like to change the h1 tag
Continue readingRendering one collection using multiple templates
Issue I am building a news feed type feature which requires client-side rendering of feed items. There are different types of feed item which means each type requires a different template. I am currently using UnderscoreJS templating but am open
Continue readingTemplating language, determine current scope
Issue I’m working with a tempting language that supports changing scope using special delimiters, like this: %% scope Foo %% Stuff %% end %% Blocks can be nested indefinitely like so: %% scope Foo %% Stuff in the Foo namespace
Continue readingHow to create my own 'Smarty' like tags
Issue what is the simplest method to do the following Look at a block of text and anywhere it finds %sometxt% replace that with something else, So basically any text that is enclosed within a set of percentage signs similar
Continue readingHow good is the wordpress templating system?
Issue I’m currently working on a PHP project using CodeIgniter as my framework. I took a look at a few templating systems I could probably use – Strogen’s Templating System (currently used in PyroCMS – if I’m not wrong), Twig,
Continue readingHow to create a master page?
Issue I need to create a master page in JSP to be used by other JSPs for them to have the same look and feel and menus. How can I do that in JSP? Solution You can use either <%@
Continue readingUsing existing html layout in asp.net
Issue This is my first time trying to make a login page. What I want to be able to do is take an existing html and put the login control on that page. I realize I can’t take the html
Continue readingJavascript templating library that infers used variables and dependencies
Issue Is there a Javascript templating library that automatically infers the variables used in the template and the possible dependencies among them? If I for example have a template that looks like this (Handlebars syntax): <script id=”entry-template” type=”text/x-handlebars-template”> <div class=”entry”>
Continue readingCode to determine folder depth "../" in PHP?
Issue Thanks in advance for the help that will be received! I used to use a code I made when I first started, due to not being able to find a snippet that does what I want. (Maybe to not
Continue readingA better way to do replacement tags in c#?
Issue I need a better way to do this: Regex.Replace(Regex.Replace(Regex.Replace(Regex.Replace(Regex.Replace(textMessage.Trim(), “{birthday}”, person.Birthday, RegexOptions.None), “{phone}”, person.MobilePhone, RegexOptions.None), “{email}”, person.Email, RegexOptions.None), “{lastname}”, person.LastName, RegexOptions.None), “{firstname}”, person.FirstName, RegexOptions.None) Solution textMessage.Trim() .Replace(“{birthday}”,person.Birthday) .Replace(“{phone}”,person.Phone) … Answered By – Reza ArabQaeni Answer Checked By – Gilberto
Continue readingYUI 3 html templating
Issue Is there any way to create HTML markup in YUI like: <div id={DivId}> <p class={pClass}> <span class={spanClass}> {Content} </span> </p> </div> Solution If I understand your question correctly, Y.substitute might be worth looking at. If you haven’t seen it,
Continue readingExecute any method by string with parameters
Issue I’ve been tinkering with a CMS that I’m making as a personal project and I have got to a point that I am stuck on. Basically I have a plugin manager that loads assemblies at runtime, looks for methods
Continue readingusing templates to apply class functions to a vector of objects
Issue Lets say I have vectors of different objects, say D is of type vector< Dog > and R is of type vector< Rock >. Is it possible to use templates so I can automatically have all member functions be
Continue readingHandlerbars.js using an helper function in a #if statement
Issue With handlebars.js I want to display two blocks of html depending of a resulting json. Let’s say I want to thanks my user for ordering items at my shop. I write my handlerbars.js template like this : <p>{{name}}</p> {{#if
Continue readingMeaning of Dollar Sign & Curly Braces Containing Javascript Block Outside of HTML Script Tag
Issue I’m currently reading ‘Javascript Web Applications’ (O’Reilly, Alex MacCaw) and very early on there’s a code snippet which might appear to execute a JS function, within an HTML document, yet it is not enclosed by <script> tags: // template.html
Continue readingFind and replace with JavaScript
Issue I am trying to create a super simple JavaScript templating solution. I want to use the JavaScript replace method to find all instances of curly braces in a template and replace them with their appropriate data. For instance, if
Continue readingFacelets as a templating framework in JSP
Issue I am very fond of the Facelets templating model. On the other hand there are many applications where plain old JSTL in JSPs is just fine and JSF would be an overkill. Is it possible to use Facelets in
Continue readingDocument templates: JavaScript as replacement for Word?
Issue We currently use Word for mail merge (labels) and personalized greeting cards (contact name in the text). Because our contact information is stored on a Web platform (SharePoint), I was thinking about replacing the Word templates with Web-based templates.
Continue readingJQuery Pure Template
Issue I cant figure out whats wrong. Its working when i tried to refresh only topics but it doesnt works when tried to refresh topics and page-links. ie. topics table’s refreshing, and ‘pagelinks’ disappearing, i thought pure cannot reach –
Continue readingknockoutjs afterRender issue in version 2, not apparent in version 1.2.X
Issue I have recently updated an existing project to KnockoutJS 2.0 from KnockoutJS 1.2.1 (although I started it using the previous version). Since updating I have noticed that afterRender seems to be firing before elements are actually fully within the
Continue readingPHP/HTML: Code reuse
Issue How does Stackoverflow reuse their code, especially the header and footer? So, basically when i click on ‘Tags’ only the content changes, not the header and footer. What are the best pratises? A link to a simple tutorial would
Continue readingWhat are the benchmarks of Javascript templating frameworks?
Issue I am trying to make an informed decision about which Javascript templating framework to use. There are so many choice, from Mustache, Handlebar, Hogan, jQuery, and Closure templates. I already have some basic rules of comparison, like filesize, maturity
Continue readingTwig PHP: Incrementing and Subtracting A Value In A Foreach
Issue I am working on a project that loops 100 times with repeating data. Every 8th post I am inserting an advertisement block, because I am using the index value to number each block output I need to subtract from
Continue readinghow can I assign object properties to dynamic elements based on the modulus operator
Issue I have created a mini template that holds and <h2> & <h3>, I have created a loop that adds .inner everytime i%2 === 0, what i would like to do is split up the data being outputted to follow
Continue readingTruncating HTML with Liquid
Issue I’m using the Liquid templating engine to display a summarised series of posts – at the moment I have something along these lines: {% for page in site.posts %} {{page.content | truncatewords: 100}} {% endfor %} The page content
Continue readingApply a class to every nth template element with knockoutjs
Issue I’ve been experimenting with knockoutjs, reworking an existing project. My current layout has the logic to determine if the rendered <div> tag is the first or fourth item. if (index % 4 == 0) addClass(‘omega’); if (index % 4
Continue readingListView DataTemplate, ControlTemplate and Style
Issue Still learning WPF….thanks for any help. Is there any way to Refactor this: <ListBox Name=”lbEvents” VerticalAlignment=”Stretch” SelectionMode=”Multiple” Loaded=”lbCenterEvents_Loaded” HorizontalAlignment=”Stretch” BorderBrush=”Transparent” Background=”Transparent” SelectionChanged=”lbCenterEvents_SelectionChanged” ItemContainerStyle=”{StaticResource KioskCheckboxListItemContainer}”> <ListBox.Resources> <SolidColorBrush x:Key=”{x:Static SystemColors.HighlightBrushKey}” Color=”Transparent” /> <SolidColorBrush x:Key=”{x:Static SystemColors.HighlightTextBrushKey}” Color=”Black” /> <SolidColorBrush x:Key=”{x:Static SystemColors.ControlBrushKey}” Color=”Transparent”
Continue readingUnderscore Templating – Partials (with RequireJS)
Issue I am using the tpl! plugin for RequireJS to import and compile my templates into my application – similar to the text! plugin: define([ “tpl!../templates/newsfeed.html”, “tpl!../templates/friends.html”, “tpl!../templates/tag.html”, “tpl!../templates/tags.html”, ], function (renderNewsfeed, renderFriends, renderTag, renderTags) { … }); This all
Continue readingKnockoutJS templates and Twitter Bootstrap/JQuery tooltip not working
Issue I have a snippet that loads Twitter Bootstrap tooltip and popover in the onload looking like this: $(‘i[rel=tooltip]’).tooltip({ placement: “left” }); That works fine with static HTML until I add KnockoutJS templating (some code omitted for brevity): <div class=”row-fluid”
Continue readingTempo js – Rendering an array of strings or simple objects, referring to "this" in the template
Issue Just getting started with Tempo javascript templating engine. In all examples in the documentation, the collection you are iterating over is an array of objects or arrays, and in the templates you refer to property names (i.e. {{name}}) or
Continue readingBackbone.js and underscore.js are creating messy html
Issue I am using the normal way of creating html bits by combining backbone.js and underscore.js. This is an example from what I use _.template($(‘#html-container’).html(), this.model.toJSON()); And I append this where I need it. The model in this case is
Continue readingumbraco – site images
Issue I have a static site with the structure index.html -css -img -js Simple question how do I get the js and img folders into the umbraco structure? Solution You don’t say if you’re using Umbraco 4 or 5. For
Continue readingtemplating in php using tpl files
Issue $data = {include “header.tpl”}{include “footer.tpl”}; private function get_tpl_includes($data){ $this->includes = preg_match_all(‘/{include \”[^}]\”*}/’, $data, $this->includes); foreach($this->includes as $include){ $tpl_file = $this->dir . str_replace($this->dir, “”, $include[0]); $html_include = file_get_contents($tpl_file) or die(“tp3”); //Get the content of the included html $pattern = ‘{include
Continue readingIncorrectly calculating dialog box position because of dynamic image loading?
Issue I’m working on a gallery type application – one template puts together a popup dialog for a larger view of thumbnail images when clicked. The server path to the image is included as a template variable. Gallery.Templates.Popup = “\
Continue readingHow podscms choose template pages to use and how to choose among more of them
Issue I’m using podscms for creating a database site. I would like to create two different wp templates to use for detail and list Pods pages so that i can load some specific scripts and code. But i really haven’t
Continue readingTemplates with out root level nodes
Issue I have been experimenting with templating in js and have come across a pretty cool problem. Say you have a handlebars template. Then compile it and output it var template = ‘<h1>Hello</h1>’ + ‘<ul>’ + ‘<li>{{name}}</li>’ + ‘<li>{{address}}</li>’ +
Continue readingCalling the correct overloaded function from a container class
Issue This is something that’s been bugging me for a while now. So let’s say you have your baseClass and derivedClass. You also have a container object of baseClass pointers that holds pointers to all the objects you’re managing. The
Continue readingUsing PHP code in PHP code?
Issue I have the following code in PHP: <?php if (function_exists(“insert_audio_player”)) {insert_audio_player(“[audio:|titles=]”} ?> Which renders an audio player to my page in WordPress. I need to call a custom field inside this code. My custom field code is also coded
Continue readingmustache/hogan i18n and taking word-order into account
Issue Found a couple of questions (and answers) on this: How is internationalization configured for Hogan.js? ,etc. but non in particular that take word order into account. I need the ability to: step 1. given a key -> lookup a
Continue readingHow can I use a Smarty template from a Smarty template?
Issue I’ve run into a funny problem. I need to use Smarty templates within a Smarty template. Here is why. I use the same templates for various wiki websites, and each website has its own configuration. The configuration contains parts
Continue readingChanging DataTemplates at runtime using DataTriggers
Issue I’m trying to change a DataTemplate for objects in my WPF application according to a specific boolean value. When the value is “True” I want the DataTemplate to be something and when the value is “False” I want the
Continue readingPreventing a security breach
Issue I am creating a website where you “post”, and the form content is saved in a MySql database, and upon loading the page, is retrieved, similar to facebook. I construct all the posts and insert raw html into a
Continue readingQuery on Block Helpers in Handlebars.js
Issue I have a product block in a template like this : <script type=”text/x-handlebars-template” id=”tmpl-person”> <div class=”product”> <!– Product details here –> </div> </script> What I want to do is if from the array of person I get as data
Continue readingInspiration / convention for element names HTML
Issue I work in front end markup so I’m constantly templating site. Does anyone know of good resources to learn some good conventions or inspiration for element names? I like names that relate to print layouts so perhaps someone could
Continue readingHow can I convert erb to html?
Issue Imagine in rails I have @template that is an instance of ActionTemplate::View. Question is: How can I convert @template whose @template.source is <%= “hello from erb” %> to hello from erb?? thanks Solution Try this… ERB.new(@template.source).result ERB#new Answered By
Continue readingMustache/Hogan JS: Is it possible to reference parent tags within a list?
Issue I have a use case where I’d like to access parent tags within list loop sections in a Mustache/Hogan JS template. For example, this is my data structure: var data = { users: [{name: “John”, age: 100},{name: “Max”, age:
Continue readingRendering Liquid Template in Controller
Issue I’m trying to have the “show” action for my pages controller render a Liquid template instead of the normal view. The template itself is stored in the database. This is my show action: def show @organization = Organization.find_by_subdomain(request.subdomain) @template
Continue readingHow many headerX.xml files can there be contained in a .docx file?
Issue I’ve set up some templating functionality which modifies existing .docx files to insert custom values. It worked for a while with the values I was interested in being contained within the files word/header1.xml and word/header2.xml Now the code has
Continue readingHTML element with no footprint, but can be a container for another element
Issue Is there an HTML element, or an element that, when combined with the correct CSS style properties, has no footprint except that it can be used as a container for other elements? It would almost be like a “marker”
Continue readingTemplating two XML files
Issue I’m trying to merge two XML documents. The first one is a kind of template with default values, and the second one has the same structure with missing fields. I would like to load both files and fill missing
Continue readingInterpolate Twig variable/attribute inside value of another Twig attribute definition
Issue Take the following example structure: {% set paths = { … ‘js’: { … ‘jquery’: { ‘version’: ‘1.7.2’, ‘cdn’: ‘https://ajax.googleapis.com/ajax/libs/jquery/{{paths.js.jquery.version}}/jquery.min.js’, ‘fallback’: …. } } } %} To access, I would normally use something like: <script src="{{paths.js.jquery.cdn}}"></script> The problem: The
Continue reading