ugenda
  ugenda
Gold Member
  Monday, 03 April 2023
  5 Replies
  287 Visits
0
Votes
Undo
I want to create a custom layout for the detail page of an event where the main image is always 100% width and the same height, wether the original image is landscape or portrait.

In my previous site / component I had a template override Joomla. I had the image as a background in a div, with an option to click on the dic and show the full image in a modal window. The dic would be there only if there was an image. (Preventing a large empty space if there's no image) The code I had was this:

<?php if ($this->dimage[original]) : ?>
<div class="headerimg">
<a href="/<?php echo $this->dimage[original]; ?>" class="modal" rel="{handler: 'image'}">
<img src = "/<?php echo $this->dimage[original]; ?>" itemprop="image" width="100%" max-height="100%" style="margin-bottom:10px; cursor: zoom-in;"><span class="zoom"><i class="uk-icon-search"></i></span>
</a>
</div>
<?php endif ?>


How can I achieve the same with custom layouts?
ugenda set the post as Normal priority — 1 year ago
ugenda set the type of the post as  Technical — 1 year ago
1 year ago
·
#230482
0
Votes
Undo
See https://www.jevents.net/frequently-asked-questions/handling-missing-values-in-custom-layouts

So with custom layouts you can use something like the following to add a class


<div class="{{IMAGE_FIELD#image-visible#image-hidden}}">
{{IMAGE_FIELD}}
</div>


Where IMAGE_FIELD is the specific field you are wanting to use in your layout

Then use image-visible and image-hidden class names to style the layout for when the image is present or not present in the event

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!

1 year ago
·
#230499
0
Votes
Undo
Thank you. As I understand the hashtag acts like an if-statement and adds css-classes to hide elements?
I'd rather use a php-if/then/else code so the items are left out before they are sent to the browser of a user.

And where can I find documentation with all the (standard) field codes? Or is it enough to select a field in the custom lay-out dropdown menu.
1 year ago
·
#230512
0
Votes
Undo
There aren't currently any if/then type codes in the layout editor I'm afraid. You can find all the fields in the drop downs.

The basic rule is

{{Field description:FIELDNAME#Value present %s output#value not present output}{

Field description before the : is thrown away
Two different output options for value present and value not set with %s replaced by the actual value

Some fields have other formats e.g. date/time fields see https://www.jevents.net/frequently-asked-questions/time-formatting-in-jevents

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!

1 year ago
·
#230590
0
Votes
Undo
It's still a bit unclear how this exactly works. For instance can I add html within the code?
Example:

{{my_field:my_field#<div>%s some text here</div>#other text}}


And can I nest fields?

{{my_field:my_field#%s {{my_otherfield:my_otherfield}}#}}
1 year ago
·
#230636
0
Votes
Undo
Unfortunately nesting fields isn't possible but you can add as much HTML as you want between the # symbols

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!

  • Page :
  • 1
There are no replies made for this post yet.

Members Area

Show your support

Unlike many Joomla calendars we do not charge to download JEvents - please show your support for this project by becoming a member of the JEvents Club Club members get access to early releases, exclusive member support forums, and Silver and Gold members can use many exciting JEvents addons

Your membership will ensure that JEvents continues to be the best events calendar for Joomla.