I have this line in a template:
jander
So as you can guess when I click that link, it executes an action. Inside that action I have this:
var_dump($request->getParameter('aux'));var_dump($request->getParameter('sf_subject'));die("fasf");
It's printing 4 and NULL. Why NULL? I expected the $category object was showed..
You can't get the sf_subject parameter that way. You can only use the sf_subject with the sfDoctrineRoute or sfPropelRoute. In your code, you can then get the selected object with $this->getRoute()->getObject().
What is the html representation of your first line?
Seems like in your template $category is not defined, so the < a > should looks like
foo.php?aux=4&sf_subject=null or
foo.php?aux=4
Define the category in your template :-)
Related
#Html.ActionLink(MultiLanguageProvider.Instance.SelectAppropriate("Портфолио", "Portfolio"), "Index", "Portfolio")
The output must be something like ".../Portfolio/Index" but I get only ".../Portfolio" instead. The Index() method is there and if I force manually the correct adress ("Porfolio/Index") - it works perfectly. The problem is #Html.ActionLink output. What's wrong with that?
Use Url.Action("action"...) instead of Html.Action(...)
I am trying to interpolate a ruby variable in a HAML%img src tag, with the ruby interpolation operator #{}. In the following way:
-#locations.each do |location|
%li
%img(src: "#{location.thumbnail_url}")
However, I get the following error:
Invalid attribute list: "(src: \"\#{location.thumbnail_url}\")".
Is there a valid way to do this? I am sure it has been done before but can't see any literature/any other posts about it.
It looks like you’re mixing the two attribute styles, the normal style and the HTML style.
You want to either replace () with {} and use the normal style:
%img{src: "#{location.thumbnail_url}"}
or use the HTML style with = instead of :, like this:
%img(src = "#{location.thumbnail_url}")
I've got a list view and for each line I want a link to another list view showing the related results. The createlink line I've finally managed to construct looks like this
my link
This generates the link
http://localhost:3278/FARTFramework/runResults/listSpecific/testExecQueueInstance.id
I know that testExecQueueInstance.id is 22 and I want the link to actually look like this
http://localhost:3278/FARTFramework/runResults/listSpecific/22
What am I missing?
The idea is that I then have a controller like so which should then list those items matching that id...
def ListSpecific(int id){
render(view: "list", model: [runResultsInstanceList: RunResults.findAllByTestExeQueueID(id, [sort:"testExecTime", order: "desc"]), runResultsInstanceTotal: RunResults.count()])
}
You are using an apostrophe on map of params.
You should try this.
my link
enjoy.
If I want to use the g.link tag to link the text "foo" to the list action of the book controller, I can do that with:
<g:link action='list' controller='book'>foo</g:link>
The code above shows the "tag syntax", but how can I do the same thing using the "method call syntax"? I tried the following:
g.link(action: 'list', controller: 'book', {'foo'})
but it doesn't work. The problem is that I can't figure out how to pass a static piece of text for the body parameter. In the example above, I've tried putting the text in a closure, but this didn't work.
If the code is e.g. inside controller, you can use:
link( controller:'book', action:'list' ) { 'foo' }
It is not necessary to use the 'g' namespace, it is automatically injected.
Like this:
g.link ([uri:'/'], {"hello"})
I have a variabla var. If I try to output its value in HAML like =val then I just get the string value of the object which looks like this: #<ShortenedUrl:0x118c50fa.
But how do I get the value that is in there?
Using Haml
%h2
#{#project.name}
or
%h2
#{org.id}
I think you may want the .inspect method.
= val.inspect
That will show you something like:
#<ShortenedURL #url="the url", #count=0, #etc="etc">
Of course, if you want to dive in to specifics (for example, you only want to show someone the url attribute (or whatever attribute you may have), then use that method:
= val.url
Which will show:
the url