Dave,

You probably need to explicitly set the instance variable on the page by 
overriding process_page.  Here's a sample (untested):

Page.send :attr_accessor, :my_instance_variable

SiteController.class_eval do
  def process_page_with_instance_var(page)
    page.my_instance_variable = @my_instance_variable
    process_page_without_instance_var(page)
  end
  alias_method_chain :process_page, :instance_var
end

 From that, your instance variable would be defined on the global page 
(tag.globals.page).

I've been looking through the Rails source, but I don't see anywhere 
where the request is given a link back to the controller it's created 
for.  You may be out of luck there.

Cheers,

Sean

Dave Bryand wrote:
> Hi,
>
> I'm trying to figure out how to access the value of an instance variable
> that gets setup on SiteController when my extension is activated. I'd
> like to use this value in a tag, but I can' figure out how to access
> that variable from the tag.
>
> If I setup a tag that just dumps the page.inspect, like the tag below, I
> can see the instance variable in the output, but I just can't figure out
> how to grab it.
>
> ----------------
>   tag 'inspect_page' do |tag|
>     tag.globals.page.inspect
>   end
> ----------------
>
> I'd like to be able to do something like
>
> ----------------
>   tag 'my_instance_variable' do |tag|
>     # @my_instance_variable is defined in SiteController on extension
> activation
>     tag.globals.page.my_instance_variable
>   end
> ----------------
>
> Anyone know how to do this?
>
> Thanks!
>   

_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to