link to .erb file, from .erb file

D

Dan Thomas

Hello,

I'm new to web development and Ruby. In an erb file, I need to provide
a link that will load up another erb file.

I know that if I want to go to an html file I could do this.

<li><a href="branding.html">Branding</a></li>

how to I do something like this:

<li><a href= <% erb: branding %> >Branding</a></li>

So that we go to branding.erb. Does that make sense? thanks
 
S

Steve Klabnik

[Note: parts of this message were removed to make it a legal post.]

You're thinking too hard.

<li><a href="branding.erb">Branding</a></li>
 
D

Dan Thomas

Steve Klabnik wrote in post #977681:
You're thinking too hard.

<li><a href="branding.erb">Branding</a></li>


Thank you.
That takes me to a page that says Sinatra doesn't know this little
ditty. Let me give some background. I have a config.ru file that has
this:

class App < Sinatra::Base
set :static, true
set :public, File.dirname(__FILE__) + '/static'

get "/" do
f1 = File.read($XML_PATH)
@xml = Nokogiri::XML(f1)

erb :index
end

sinatra/base is required in that file. index.erb is located in my views
folder. Then, as stated above, from that index.erb, I need to load
something like a "branding.erb" page if the user clicks a link. Thanks
 
Q

Quintus

Am 26.01.2011 20:13, schrieb Dan Thomas:
Steve Klabnik wrote in post #977681:


Thank you.
That takes me to a page that says Sinatra doesn't know this little
ditty. Let me give some background. I have a config.ru file that has
this:

class App < Sinatra::Base
set :static, true
set :public, File.dirname(__FILE__) + '/static'

get "/" do
f1 = File.read($XML_PATH)
@xml = Nokogiri::XML(f1)

erb :index
end

sinatra/base is required in that file. index.erb is located in my views
folder. Then, as stated above, from that index.erb, I need to load
something like a "branding.erb" page if the user clicks a link. Thanks

This has nothing to do with the view, but how your Sinatra app processes
the requests it receives. Add this to your App class:
 
D

Dan Thomas

Marvin G=C3=BClker wrote in post #977698:
Am 26.01.2011 20:13, schrieb Dan Thomas:

This has nothing to do with the view, but how your Sinatra app processe= s
the requests it receives. Add this to your App class:
link to it via

Ahh, I was starting to head in that direction but not quite getting it. =

Your post helped a ton. Thank you, Marvin!!

-- =

Posted via http://www.ruby-forum.com/.=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top