Hello Annet,

What the purpose? In theory, in the first case you page will be displayed
without the layout and you may have some html error because image will not
be available. In your seconde example, better to me, you will have the
layout displayed but the content of your page will be skip entirely if
landingpage.heroShot
is empty... I think it more what you want to do. Maybe you could also write
an else where you tell your user that the content is not available for some
reason...

Maybe your example 1 should be like this :

{{if landingpage.heroShot:}}
      {{include 'landingpage/hero_shot.html'}}

and in the inlcuded view:

<div class="row-fluid m-bot30">
  <div class="span12">
    <div class="hero-shot">
      <img  src="{{=URL('static','img/landingpages/%s'
%landingpage.heroShot)}}" alt="" />
    </div>
  </div> <!-- /.span12-->
</div> <!-- /.row-fluid -->

{{pass}}

You can also, manage that at the controller level :

if landingpage.heroShot:
    ...
else:
    redirect(URL(master error page for app))  # That what I do everywhere
there is any kind of exception that return no data or access is prevented
for some reason, I redirect on a error page where the user is allow to send
a email to the admin for investigation...


That way you don't have to much if and logic in your view...

Richard



On Wed, Aug 14, 2013 at 8:46 AM, Annet <[email protected]> wrote:

> Does it make any difference whether you do:
>
> {{if landingpage.heroShot:}}
>       {{include 'landingpage/hero_shot.html'}}
> {{pass}}
>
> and in the inlcuded view:
>
> <div class="row-fluid m-bot30">
>   <div class="span12">
>     <div class="hero-shot">
>       <img  src="{{=URL('static','img/landingpages/%s'
> %landingpage.heroShot)}}" alt="" />
>     </div>
>   </div> <!-- /.span12-->
> </div> <!-- /.row-fluid -->
>
>
> or you do:
>
> {{include 'landingpage/hero_shot.html'}}
>
> and in the included view:
>
> {{if landingpage.heroShot:}}
> <div class="row-fluid m-bot30">
>   <div class="span12">
>     <div class="hero-shot">
>       <img  src="{{=URL('static','img/landingpages/%s'
> %landingpage.heroShot)}}" alt="" />
>     </div>
>   </div> <!-- /.span12-->
> </div> <!-- /.row-fluid -->
> {{pass}}
>
>
> Kind regards,
>
> Annet
>
> --
>
> ---
> 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 [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to