Link to .erb file, from .erb file

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

···

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

You're thinking too hard.

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

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

···

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

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

···

Am 26.01.2011 20:13, schrieb 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

-----------------------------------------------
get "/branding" do
  erb :branding
end
-----------------------------------------------

Assuming you want to link to /branding. In your view, you can then just
link to it via

-----------------------------------------------
<a href="/branding">Branding</a>
-----------------------------------------------

Vale,
Marvin

Marvin Gülker wrote in post #977698:

···

Am 26.01.2011 20:13, schrieb Dan Thomas:

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:

-----------------------------------------------
get "/branding" do
  erb :branding
end
-----------------------------------------------

Assuming you want to link to /branding. In your view, you can then just
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/\.