link_to and other view helpers not included with EJS (bundled with Express) for Node.js?

I've set up a nodeJS server using the Express web framework, using the EJS template engine.

When I try to use the EJS link_to view helper inside a view, I get a reference error. Is this because I am doing something wrong, or are the view helpers just not included?

I've tried the following

<# link_to("...", "...") #> <#= link_to("...", "...") #> <#- link_to("...", "...") #>

Note: I've configured custom tags for EJS...

server.configure(function () { this.set("view engine", "ejs"); this.set("view options", { open: "<#", close: "#>" }); });

-------------Problems Reply------------

Add https://github.com/mhayashi/express-helpers , that should solve the problem..

Had some problems with their : require('express-helpers').all function though, rolled my own. Besides that it works fine.

try :

var helpers = require('express-helpers')

and then

helpers(app);

in your app.js if still not working, try <%- link_to instead of <%= link_to

Category:node.js Views:6 Time:2011-04-05

Related post

  • What's a good way to test 'link_to' and other view helpers from the rails console? 2010-12-01

    I use the rails console a lot and was wondering what the best way to test view helpers such as 'link_to' or 'url_for' using it. What's the best way to do this? --------------Solutions------------- just include the UrlWriter module in your console: in

  • How to automatically include a module in a class based on its name (like helpers are included in views) 2011-11-04

    In my app I am having to interface with some 3rd party software I hope one day to replace. So, rather than keeping all the code that maps between my models' data and the form it needs to be in for the 3rd party software in the models themselves, I've

  • Using Rails view helpers with Haml::Engine 2011-03-02

    I have a Rails app in which I am rendering a block of Haml stuff stored in a model attribute. It would be nice to use Rails view helpers in that block of Haml. Currently I am using the Haml::Engine#render in a view helper to render the content of thi

  • Using rails named routes and url/view helpers within custom rendered ERB templates 2009-10-30

    I could use some help on including and extending Ruby modules and classes. My previous question handled the named routes, but not all of the view/tag helpers due to the default_url_options Hash. The issue here is that ActionController::UrlWriter meth

  • Zend: Where/how can I register custom view helpers? 2010-02-03

    In my layout.phtml file I have : <?php echo $this->Test(); ?> I have created a Test view helper at application/views/helpers/Test.php <?php class My_View_Helper_Test extends Zend_View_Helper_Abstract { public function Test() { return 'tes

  • Zend: ACL logic in View helpers 2010-02-03

    Background information: I'm in my admin module, and I created a view helper in modules/admin/views/helpers/AdminPanel.php. I have a layout plugin that forces my view to use the layout in admin/views/layouts/default.phtml. I'm trying to access my ACL

  • Zend Framework - When to use viewscripts/partials vs view helpers 2010-03-05

    I'm creating a library of display objects for our application. They render the html of a lot of the common objects (users, conversations, messages, etc) in various views. By views I mean the object can spit back different 'zoom levels' of itself with

  • Top 10-15 rails view helpers I should learn first? 2011-02-15

    I am learning rails 3, and want to know which view helpers I should master first? i.e. which ones are used the most often? 1. form_for 2. ?? .. .. --------------Solutions------------- I think these are generally considered quite important and they sh

  • Unable to initialize Jquery(Zendx) and View helpers in Bootstrap.php(ZF: 1.10.8) 2011-03-13

    Im unable to initialize Jquery(Zendx) and View helpers in Bootstrap.php(ZF: 1.10.8) But Im able to initialize the same in every controller's init() method. //My Bootstrap.php <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { pro

  • How do I extract Rails view helpers into a gem? 2011-04-26

    I have a set of rails view helpers that I use regularly, and would like to package them up into a gem, such that I could just put a line in my Gemfile, and have the helpers accessible from my views. I have created gems before using Bundler, and Jewel

  • Have there been any efforts to port some of Rails' View Helpers to Javascript? 2011-05-10

    It would be great to have helpers like linkTo(), truncate(), and pluralize() in Javascript. Have there been any efforts to port some or all of Rails' view helpers to Javascript? --------------Solutions------------- If you just need one or two, you ca

  • Calling view helpers from within rack middleware? 2011-08-17

    I am writing a rack middleware that injects a form before the closing body tag of a html document. Is there an easy way to use the existing rails view helpers (form_tag) to render the form and use interpolation to include a form into the rack respons

  • How to load helper from app/views/helpers CakePHP 2011-11-21

    In our project we have placed the helper inside app/view/helper folder. It works fine in the application. The issue I am facing is that I using facebook plugin by webtechnick, and when I use helper in the plugin view, it tries to load the helper from

  • Should I use a view to render complex json data where I need view helpers? 2011-12-11

    I'm thinking about this since a while: I'm build a single-page webapp with ExtJS library. The whole GUI will be handled with JSON through AJAX requests, so I effectively never use the view functionality (except for the main page, where the view is si

  • How do I use view helpers with ruby-ejs 2012-01-21

    I have a rails app that's using the ruby-ejs gem to compile js templates which I am then using in my backbone views. I would like to use some view helpers to create form elements, such as select tags, within my templates. I found some EmbeddedJS View

  • Writing EJS View helpers 2012-01-26

    I have a rails-backbone project that generates jst.ejs templates. I'd like to include some view helpers within there, but I'm having a helluva time figuring out how to include either EJS or JST functions into that template file. If anyone could offer

  • Zend Framework can't find standard view helpers 2009-12-02

    I'm trying to use a View helper inside a view. I put echo $this->formCheckbox('foo'); in the view, but it errors out and tells me FormCheckbox.php /application/modules/user/views/helpers/FormCheckbox.php can't be found. Why isn't it loading Zend_V

  • Problem With View Helpers 2010-02-17

    I wrote few custom view helpers but I have a little trouble using them. If I add the helper path in controller action like this: public function fooAction() { $this->view->addHelperPath('My/View/Helper', 'My_View_Helper'); } Then I can use the

  • does Ruby on Rails have a way to use jQuery rather than Prototype under-the-bonnet for its ajax view helpers? (e.g. "link_to_remote") 2010-02-24

    Does Ruby on Rails have a way to use jQuery rather than Prototype under-the-bonnet for its ajax view helpers? (e.g. "link_to_remote") --------------Solutions------------- jRails works for Rails 2, overriding various functions to get the job done. How

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.182 (s). 11 q(s)