On Tuesday, October 30, 2018 at 7:41:09 AM UTC-7, Francis Windram wrote:
>
> Good Evening,
>
> I'm a relative newby to web2py, but with a few years of Python under my 
> belt and old knowledge of HTML (from the pre-HTML5 days).
>
> When I deploy a new release, part of the procedure is to update the 
> version line in appconfig.ini, e.g.:
>
> [app] 
> appname = Webapp
> version = 1.0.0 
>
> to
>
> [app] 
> appname = Webapp
> version = 1.0.1 
>
>
>
> Now this all works fine, but I want to display this as part of the footer 
> in a form akin to:
>
> Webapp v1.0.1, Copyright © 2018
>
> This footer is currently generated in (the default) layout.html as follows:
>
>     <footer class="footer">
>       <div class="container-fluid">
>         <div class="copyright pull-left">{{=T('Copyright')}} &#169; 
> {{=request.now.year}}</div>
>          <div id="poweredBy" class="pull-right">
>             {{=T('Powered by')}}
>             <a href="http://www.web2py.com/";>web2py</a>
>           </div>
>       </div>
>     </footer>
>
>
> I know that in a controller you can access the appconfig args using code 
> along the lines of:
>
> from gluon.contrib.appconfig import AppConfig
>
> appconf = AppConfig(reload=False)
> print(appconf.take("app.version"))
>
>
> However, I have no idea how to do a similar call to the appconfig 
> variables from a view.
> Any ideas? Do I need a controller to serve this information to the view? 
> And if so, in what controller file would that controller reside?
>
> Many thanks,
> Francis
>

Views are assembled on the server (except for things like jQuery), and have 
a "this piece is python" syntax which you can see in the footer example  
{{=T('Copyright')}} // Apply T() to the string 'Copyright' and insert here
{{=request.now.year}}  // insert here the value of request.now.year

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to