Questions tagged [view-helpers]

Use this tag for questions on ViewHelpers as used by the Fluid templating engine.

Viewhelpers are a part of Fluid. Fluid is a templating engine used primarily by TYPO3 and Neos.

ViewHelpers are special classes which build on base classes provided by Fluid. These classes can then be imported and used as part of the Fluid language.

More information:

423 questions
6
votes
1 answer

helper for all views in a namespace

Is there a way to create a view helper file that will be available to all views in a namespace? Like application_helper.rb, but only working for a given namespace. Specifically, I have a namespace called "office". I want to set up a view helper that…
Brett
  • 2,775
  • 4
  • 27
  • 32
6
votes
1 answer

What is the difference between render() and renderStatic() and what should be used when writing a ViewHelper in TYPO3

There are several examples for writing a custom ViewHelper and different ways to do things. I have seen examples with render() and with renderStatic (for example in Developing a Custom ViewHelper). In 24 Fluid Tips there is an explanation, but I…
user9073987
6
votes
1 answer

Zend Framework Url View Helper adds "id" by default

I'm creating a simple CRUD for adding links to a category. Each category has an id. I have a view that lists all the links for a certain category. In that view I have a link to the add-form which is: http://example.com/link/add/categoryId/3 I…
Niels Bom
  • 8,728
  • 11
  • 46
  • 62
6
votes
1 answer

Zend framework 2 : Service locator in view helper

I'm trying to access the service locator in a view helper so i can access to my config. I'm using this view helper for a recursive function so i don't know where to declare the service locator. namespace Application\View\Helper; use…
Brieuc
  • 3,994
  • 9
  • 37
  • 70
6
votes
4 answers

Erubis block helper throwing error with concat

I have a couple of block helpers, here's a simple example of what I'm doing: def wrap_foo foo, &block data = capture(&block) content = "
#{data}
" concat( content ) end I'm…
DEfusion
  • 5,533
  • 5
  • 44
  • 60
6
votes
3 answers

Rabl.render: how to use view helper methods?

I'm using Rabl to generate XML output in a rake task: xml = Rabl.render @listings, 'feeds/listings', :format => :xml # do stuff with xml However, I need to use multiple helper methods in the rabl view file referenced, and I keep getting a…
eirikir
  • 3,802
  • 3
  • 21
  • 39
6
votes
1 answer

How to use an HTML entity in a Rails "content_tag" attribute?

I've got a Rails 3 helper which needs to generate elements which might have HTML entities in the attribute values. For example: content_tag(:input, nil, :type => 'button', :value => 'Redo ↻') I end up with this:
maerics
  • 151,642
  • 46
  • 269
  • 291
6
votes
2 answers

How to use the partial in zendframework2

In ZF1 we use partial in layout.phtml file something like that $this->partial('header.phtml', array('vr' => 'zf2')); How we can do the same in ZF2?
Developer
  • 25,073
  • 20
  • 81
  • 128
5
votes
1 answer

Creating custom helper available in views

I have too much text utility methods, like MakeShortText(string text, int length), RemoveTags(string text), TimeAgo(DateTime date) and other. I want to access them from separate helper like in next example: @Text().MakeShortText(Model.Text, 10) Is…
David Levin
  • 6,573
  • 5
  • 48
  • 80
5
votes
1 answer

Can View helper read request

In an action helper, I can get request using $this->getRequest(); Anything similar for a view helper?
jarn
  • 263
  • 1
  • 2
  • 7
5
votes
2 answers

TYPO3 ver. 7.6.2 - Condition ViewHelpers evaluated only once

Problem: I wrote a conditional VH (extending AbstractConditionViewHelper) and it works as usually, anyway I realized that in non-cached version it is evaluated only once. Initialy I thought that's my bug, but checked common and the problem…
biesior
  • 55,576
  • 10
  • 125
  • 182
5
votes
1 answer

Zend Framework - Loading View Helpers from Modules

I am putting together a modular application in Zend Framework and am struggling to get module specific View Helpers to load. My directory structure is like this... application ---configs ---controllers ---forms ---layouts ---models …
Martin
  • 235
  • 5
  • 16
5
votes
3 answers

How to assign variable in fluid?

I want viewhelper that can be helpful to assign variable in fluid, I dont want variable to be passed from controller.
Vishal Tanna
  • 1,165
  • 2
  • 12
  • 36
5
votes
2 answers

The name 'Url' does not exist in the current context error

I have an MVC4 project that I am trying to create a helper for. I have added a folder called "App_Code", and in that folder I added a file called MyHelpers.cshtml. Here are the entire contents of that file: @helper MakeButton(string linkText, string…
Todd Davis
  • 5,855
  • 10
  • 53
  • 89
5
votes
2 answers

How to use a custom form view helper in Zend Framework 2?

I wrote a form view helper, that extends the Zend\Form\View\Helper\FormMultiCheckbox and overwrites its renderOptions(...) method:
automatix
  • 14,018
  • 26
  • 105
  • 230
1 2
3
28 29