w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Difference between render :template and render :partial in rails 3
The render :partial looks for the file name to be proceeded by an underscore while the template does not: render partial:'example' looks for _example.html.erb while: render template: 'example' looks for example.html.erb There may be other issues, but odds are this is why you recieved the error based on it working once you made the change. Hope this helps...

Categories : Ruby On Rails

trying to render html files using jade but it still adresses it as a jade
With this line: app.engine('.html', require('jade').__express); You told express to render templates ending with .html using jade. With this one: app.set('view engine', 'html'); you told express that it should interpret template names without extension as ones ending with html. So my guess is that you're trying to render 'index', express interprets it as index.html and then passes to jade as it was instructed to do. It's better to map jade to it's own extentension (.jade is an obvious candidate). And render your index.html using it's full name. Add consolidate.js to your project: var engines = require('consolidate'); Tell jade to render stuff ending with .jade. app.engine('jade', require('jade').__express); Register simple html renderer for stuff ending with .html: app.eng

Categories : Javascript

Ember.js "template to render" versus "template to render into"
The template to render is a handlebars template name. If you don't specify one Ember will assume the template name is the same as the route name: 'post'. Here you have specified 'favoritePost' as the template name instead. The template to render into determines where to render the 'favoritePost' template. The default is the {{ outlet }} on the 'application' template. Here you have specified that the 'favoritePost' template should render into the {{ outlet }} in the 'posts' template (which should be an ancestor route). In this way you can nest data: a list of all posts and a view of the selected post, etc.

Categories : Ember Js

Is it possible to render x.jade partial in angular?
Yes it is possible. Look at the following link Two important points to note are: templateUrl: 'partials/some' instead of templateUrl: 'partials/some.jade' and Add the following in routes: ( the code is for expressjs in node) app.get('/partials/:name', function (req, res) { var name = req.params.name; res.render('partials/' + name); });` Quit and relaunch node/express server.

Categories : Angularjs

Render single block in jade
Jade supports executable code. When used prefixed - (without buffering). For example you can use if statment in main layout jade template: - if (renderType && renderType == 'page') { doctype 5 html head title= title body - } block content Render html page like: res.render('index', { title: 'StackOverflow', renderType: 'page' }); Render html block like: res.render('index', { title: 'StackOverflow', renderType: 'block' }); And if you don't like use renderType variable in all render expressions, use res.locals(obj) //*Assign several locals with the given obj. The following are equivalent:* and set default value for all requests. Where you init app add handler: var logger = function(req, res, next) { res.locals({renderType:'page

Categories : Javascript

Jade Render Header with 'active' Class
ul.header li a(href='/', class=(activePage === 'home' ? 'active' : '')) HOME li a(href='/one', class=(activePage === 'one' ? 'active' : '')) ONE li a(href='/two', class=(activePage === 'two' ? 'active' : '')) TWO

Categories : Node Js

how can I make express render any jade file in one directory, regardless of path depth?
params cannot contain /. When evaluated the url is tokenized by / to get params. When you do app.get('/partials/:filename', routes.partials) it matches partials/index.jade because req.params.filename is set to index.jade (only one valid params). But it does not match partials/test/index.jade because two params are required to match. To achieve what you want you can do this app.get('/partials/*', routes.partials) and in routes do: exports.partials = (req, res)-> filename = req.params return unless filename # might want to change this console.log "rendering partial at #{filename}" res.render "partials/#{filename}" In above code req.params matches everything after /partials/ so you render the path correctly. So you can even create sub directories inside them

Categories : Node Js

CSS @Styles.Render not rendering stylesheet
There seem to be two parts to the problem. CSS One part of the problem is related to invalid CSS. For example, border-top is the shorthand declaration for a combination of style, width and colour: border-top: [width style colour] With this in mind, I would change your CSS as follows: header { border: 2px solid #0094ff; /* width style colour */ border-bottom-right-radius: 10px; border-top-style: hidden; border-left-style: hidden; box-shadow: 2px 2px 0px #000; /* x-offset y-offset blur colour */ } IE / Compatibility Mode If IE is coming through in compatibility mode, you're probably rendering using the IE8 (or older) engine. Unfortunately these do not understand HTML5, so things like the <header /> elements and border-radius and box-shadow CSS declarati

Categories : HTML

android.graphics.Path doesn't render on device, but does render on simulator
EDIT: To be clear: Yes, it's caused by hardware acceleration bugs. But ... if I disable hardware-acceleration, I hit other (major) bugs in the Android software implementation of Canvas :(. OK, so it turns out the core Android class "Path" is fundamentally broken :(. There are two constructors. One of these constructors is "not implemented" on hardware. This is not documented. I'd consider this a showstopper bug - it creates no warnings, no errors, it just breaks the API and any apps that use it :(. This constructor: http://developer.android.com/reference/android/graphics/Path.html#Path%28android.graphics.Path%29 public Path (Path src) Added in API level 1 Create a new path, copying the contents from the src path. ...mustn't be used. Sigh.

Categories : Android

Is is possible to render a normal template html.erb template with active admin?
This is one way to do it: In app/admin/stats.rb: ActiveAdmin.register_page 'Stats' do content do render 'index' end controller do def index @foo = 'bar' end end end And rename app/views/admin/stats/index.html.erb to app/views/admin/stats/_index.html.erb (Notice the _) And it works fine. From what I understand, if index.html.erb is present in views/admin/stats, the content block is not called. If index.html.erb is renamed into something else, then we go into the content block, then the layout rendering is called...

Categories : Ruby On Rails

how to make a meteor template helper re-run/render after another template has rendered?
You need a dependency in the template that you want to rerun. There are few possibilities, depending on what data you want to get. For example, you can set a reactive marker in the content template that will notify renderNav that it's done with drawing. Template.contentWidnow.rendered = function() { ... // Set this on the very end of rendered callback. Session.set('contentWindowRenderMark', '' + new Date().getTime() + Math.floor(Math.random() * 1000000) ); } Template.renderNav.contentData = function() { // You don't have to actually use the mark value, // but you need to obtain it so that the dependency // is registered for this helper. var mark = Session.get('contentWindowRenderMark'); // Get the data you need and prepare for displayin

Categories : Javascript

WebGL rendering transparent objects. Render order
There are no transparent objects in your demo, only opaque ones. You are changing the visibility. WegGLRenderer sorts objects based on their distance from the camera, and renders objects in the sorted order. It renders opaque objects from front to back. The rendering order can change due to how the sorting algorithm breaks ties when two objects are the same distance from the camera. However, the render order is not necessarily changing when you toggle the visibility off and then on again. What can be changing is the distance to the depth buffer in the least significant digits due to roundoff when you move the camera. Hence, sometimes the second object renders, and sometimes it does not. You have two cubes of exactly the same size and orientation in exactly the same location. Do not do

Categories : Three Js

Grails rendering plugin (pdf ) does not render Checkbox input
Rendering plugin does not render image using img tag. You have to use rendering plugin's tags to render the image. <rendering:inlinePng bytes="${imageBytes}" class="some-class" /> and many more. Please have a look in the link. Grails Rendering Plugin - Reference Documentation

Categories : Grails

dompdf codeigniter , i am trying to render two htmls i get error on render
I have come up against this issue also. This error can happen for a few reasons. There are three options you can check: reinstalling your DOMPDF library make sure mbstring is installed/configured/enabled for PHP make sure you are re-initialising, or creating a new instance of DOMPDF when looping. As it sounds like you have already output one PDF successfully, this indicates the first two options are likely not the issue. We can't see your complete code that relates to the issue, but it seems probable it is the third option. If it is the third, then you would make sure the loop that creates the pdfs started with the line: $this->pdf = new DOMPDF();

Categories : PHP

Render to template and get a response
Yes, it is because the final html template is rendered only once. While rendering abc.html, it looks for all template variables and replaces them. In this case only 'html' got replaced by its value. And then the html got rendered because it doesn't find any other variable or included html. If you are passing a template variable inside another template variable, then it will not get rendered. You can do something like this: #abc.html {{HEADER}} {{ CONTENT }} {{FOOTER}} #in view html_content =TemplateResponse(request,"abc.html {'CONTENT':html_content,'HEADER':html_header,'FOOTER':html_footer}) For this you need to make changes in the format of html in database. But as you said, in your case there can be many template variables apart from header and footer, then you can update the 'htm

Categories : Python

Render js template through php using mustache
At the end I found a solution for this. Print the output of a php file on an ajax call. Mustache_Autoloader::register(); $m = new Mustache_Engine(array( 'loader' => new Mustache_Loader_FilesystemLoader('./templates/') )); echo $m->render('templatename', $o); and then using .html(data); with jQuery

Categories : PHP

How can I render a template in Go without any variables?
This is impossible in Go, by design - if you don't have data, the Template package is unnecessary overhead. If you have no data, just read the file using the io package, instead of using templates.

Categories : Go

Render template and array with handlebar
Why you can't use Handlebars template comments like {{! }}? That indeed will solve your issue, just replace the <?php ?> tags from the comments and that code will stripped from the final template.

Categories : PHP

Url not changing , just render the template after login
You need to tell it where to go after login using the next url parameter: <form class="form-signin" action="{% url django.contrib.auth.views.login %}?next=employer/home/" method="post"> or set the LOGIN_REDIRECT_URL in settings: The URL where requests are redirected after login when the contrib.auth.login view gets no next parameter.

Categories : Python

Extjs , how to render a button to template
This problem is described here: http://www.sencha.com/forum/showthread.php?114317-Button-In-a-Template&p=534588&viewfull=1#post534588 There is a simple example code aswell.

Categories : Javascript

How to render template directly without having a handler
Yes, you can. But still need the single handler for that: # app.yaml - url: /rest/.* script: main.app # main.py class PageHandler(webapp2.RequestHandler): def get(self, page): if not page.endswith('.html'): page += '.html' self.response.write(self.jinja2.render_template(page)) app = webapp2.WSGIApplication([ webapp2.RedirectRoute('/rest/<page>', PageHandler, name='page'), ], debug=True) Then you just link your pages with /rest/index.html or /rest/path/to/page But if you are purely using this for static files, this will still use an instance to generate these pages, if you like you could use my app-engine-static github project. It's basically a project that would help you build dynamic sites using jinja2 then generate the static files and th

Categories : Python

Symfony2 hook after template render
There's a hook on kernel.response: http://symfony.com/doc/current/cookbook/event_dispatcher/before_after_filters.html

Categories : Symfony2

How to set cookie in Django and then render template?
def index(request, template): response = HttpResponse('blah') response.set_cookie('id', 1) id = request.COOKIES.get('id') return render_to_response(template,{'cookie_id':id})

Categories : Django

Is there an easy way reverse a template render?
As far as I know this is not a Django feature. So, no, there is no way in Django. If you have the template, you will have to create a way of parsing the html/xml, and compare it with the template in order to associate each change to each {{context_label}}. This seems like an interesting problem, but I don't see how its solution can be useful in a standard web-app (thus I see no reason why Django would have this feature in the first place).

Categories : Django

How do I render a sidebar inside of every template except index.hbs?
Add a boolean property in your index route/controller. App.IndexRoute = Em.Route.extend({ skipSidebar: true }); Then, in your template {{#unless skipSidebar}} {{partial 'sidebar'}} {{/unless}}

Categories : Ember Js

Ember.js - default template to render into an outlet?
I must admit this property is not well documented and buried in the docs for Ember.View but you could try setting the defaultTemplate property on your ApplicationView. See here for more info on that (search in the page for 'defaultTemplate'). Hope it helps.

Categories : Ember Js

Execute script after template render in Ember
Everything that needs to be executed after the view has been rendered into the DOM can be done in the didInsertElement hook of a view. For example if your view is called index then define a view: App.IndexView = Ember.View.extend({ didInsertElement: function() { jQuery('#nav').spasticNav(); } }); Hope it helps.

Categories : Jquery

Render a template with model outside of rootElement with Ember.js
I created a new ember view, with the template name matching my handlebars template. Then instantiated it in an ember initializer. Ember.Application.initializer({ name: "clock_view", initialize: function(container, application) { var view = App.ClockView.create(); view.replaceIn('#now'); } }); See full example on jsfiddle: http://jsfiddle.net/amiel/2FsxA/1/ I'm not going to accept my own answer just yet to see if anyone else has a better way to do this. UPDATE: Here's another possible solution: http://jsfiddle.net/amiel/2FsxA/3/ TL;DR: App.ApplicationRoute = Ember.Route.extend({ setupController: function(controller, model) { this.setupClock(); this._super(controller, model); }, setupClock: function() { var view = App.ClockView.create(

Categories : Ember Js

Using jsPDF to render dynamic data on PDF template
All of what you ask can easily be done using XSL FO to generate the PDF, scraping the SVG from the application. Most XSL FO processors would also support stamping in the charts onto static PDFs or even generating the content of the pages dynamically.

Categories : Javascript

Rails: render template looking for the wrong partial
When you render another controllers action the page that is displayed will look in the calling controllers views for any partials within itself. You can get around this by explicitly declaring the path to partials within the page so that even when called from another controller it will always look in the right place. # tasks/index page <%= render 'tasks/some_partial' %> Now no matter which controller renders this page it will always look in tasks for its partials.

Categories : Ruby On Rails

Mailer template render issue in outlook
First rule: Use Tables! You should read this guidelines to HTML-Emails: Beginner Guide More Guides

Categories : HTML

Render coffee partial in slim template
You shouldn't use any filter at all. Your slim file should just use = render 'my_partial' and your partial should contain coffee: # coffee script here

Categories : Ruby On Rails

EmberJS: How to render a template on select change
If you need to show only a frament, when exist something selected, you can use the if handlebars helper: In your template ... {{#if selectedLocationType}} Any content here will be visible when selectedLocationType has some value {{/if}} ... {{view Ember.Select contentBinding="model" selectionBinding="selectedLocationType" optionValuePath="content.id" optionLabelPath="content.name"}} I hope it helps

Categories : Javascript

How do I get a detail view template to render in emberjs?
There are a couple things going on here. In your router, you have defined details as resource, but your app uses it as a route. The difference between the two can be found in the Ember.js guide. Notice the difference in naming convention; if details is defined as a sub-resource, Ember will match it to the DetailsController controller. A resource is in fact what you want, but the contemporary theory is that it should simply be called post, and thus match up with PostController, PostRoute, etc. Here's what your router would look like: App.Router.map(function () { this.resource('about'); this.resource('posts', function () { this.route('post', { path: ':post_id' }); }); }); There is no {{outlet}} tag for your details to render into. You have a UI decision to make he

Categories : Ember Js

How to insert data to a template after render ? (django)
I think the better approach will be to implement your context processor to add verification context variable to the template contexts. For example: verification_context_processor.py def add_verification(request): #get verification code ctx = {'verification': 'xxxxx'} #you can also check what path it is like #if request.path.contains('/someparticularurl/'): # add verification return ctx In settings.py, update import django.conf.global_settings as DEFAULT_SETTINGS TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + ( 'custom_context_processors.add_verification', ) You view should use RequestContext while rendering the response. def my_view(request): # View code here... return render_to_response(request, 'myapp

Categories : Python

Render Grails template from external source
Looking at this thread it seems that you can transform a String in a template using groovyPagesTemplateEngine. Example: // compile the gsp def compiledContent = groovyPagesTemplateEngine.createTemplate(content, 'SomeUniqueIdForTheContentBeingRendered') // render the gsp def sw = new StringWriter() compiledContent?.make(args)?.writeTo(sw) String renderedContent = sw.toString()

Categories : Grails

How to Create and Render Basic Template in Golang?
in you google appengine console change in basic settings the auth, to openid provider then add the following code, it checks if an appengine user is logged in, if not he will show him the google login page. u := user.Current(c) if u == nil { url, err := user.LoginURL(c, r.URL.String()) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } w.Header().Set("Location", url) w.WriteHeader(http.StatusFound) return }

Categories : Google App Engine

Grails render won't render view
Render the view directly instead of providing the relative path in the action:- def internalServerError() { render view: 'internalServerError' } with grails-app/views/error/internalServerError.gsp in place. UPDATE Here is how it works: //UrlMapping: "500"(controller: 'errors', action: 'internalServerError') //ErrorsController: class ErrorsController { def index() { response.sendError(500) } def internalServerError(){ render view: 'internalServerError' } } //grails-app/views/errors/internalServerError.gsp This is my customized Internal Server Error. Try hitting the index action of the controller. http://localhost:8080/yourApp/errors You should see your customized error page. The same holds good if you are trying to handle Exceptions, like "50

Categories : Grails

Angular : how to re-render compiled template after model update?
I only see you setting the 'hidden' class on the element based on that rule (after a yes/no) in the link function. That's only called once for the DOM element - when it's first created. Updating the data model doesn't re-create the element, it updates it in place. You would need a mechanism that does re-create it if you wanted to do it this way. I see three ways you can do this: In your linker function, listen for the same dropEvent that you listen for above. This is more efficient than you'd think (it's very fast) and you can re-evaluate whether to apply this hidden class or not. Use something like ngIf or literally re-creating it in your collection to force the element to be recreated entirely. This is not as efficient, but sometimes is still desirable for various reasons. If your use

Categories : Angularjs

Change template via parameter when render a controller action?
There is no native parameter to change the template but you can pass an argument to the action defined by the render method ... { render(controller('MyBundle:MyEntity:index', { 'template': 'MyBundle:ControllerName:foo.html.twig' })) }} ... and use it inside your controller action to decide which template to render. class MyEntityController { public function indexAction($template = null) { // ... some code here $template = $template ? $template : 'MyBundle:ControllerName:index.html.twig'; return $this->render( $template, array( 'variable' => $variable, ) ); }

Categories : PHP



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