New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Contao 3.3 RC1] Can't take calendar event's image teaser in templates #7001

Closed
rocchidavide opened this Issue May 14, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@rocchidavide

rocchidavide commented May 14, 2014

I need image teaser in cal_default.html5 for each event listed. A print_r() of $event says that.

[addImage] => 1
[singleSRC] => ��Y!~���9�� ��
[alt] => 
[size] => a:3:{i:0;s:0:"";i:1;s:0:"";i:2;s:12:"proportional";}
[imagemargin] => a:5:{s:6:"bottom";s:0:"";s:4:"left";s:0:"";s:5:"right";s:0:"";s:3:"top";s:0:"";s:4:"unit";s:0:"";}
[imageUrl] => 
[fullsize] => 
[caption] => 

So, imageUrl is empty. How can I obtain the image url?

@leofeyer leofeyer added this to the 3.3.0 milestone May 14, 2014

@leofeyer leofeyer added invalid and removed defect labels May 19, 2014

@leofeyer leofeyer removed this from the 3.3.0 milestone May 19, 2014

@leofeyer

This comment has been minimized.

Show comment
Hide comment
@leofeyer

leofeyer May 19, 2014

Member

I think you are jumbling things up here. The imageUrl parameter refers to the "Image link target" field. It does not store the file path; you have to use the FileModel class to obtain it.

Member

leofeyer commented May 19, 2014

I think you are jumbling things up here. The imageUrl parameter refers to the "Image link target" field. It does not store the file path; you have to use the FileModel class to obtain it.

@leofeyer leofeyer closed this May 19, 2014

@rocchidavide

This comment has been minimized.

Show comment
Hide comment
@rocchidavide

rocchidavide May 19, 2014

In system/modules/calendar/classes/Calendar.php, I see this code (from line 439):

    // Add the article image as enclosure
    if ($objEvent->addImage)
    {
        $objFile = \FilesModel::findByUuid($objEvent->singleSRC);

        if ($objFile !== null)
        {
            $arrEvent['enclosure'][] = $objFile->path;
        }
    }

If I have understood right, I should find the image path in $event['enclosure'] (in my cal_default.html5 template). But this key is empty.
Is this the usage of FilesModel that you referred?
Thank you

rocchidavide commented May 19, 2014

In system/modules/calendar/classes/Calendar.php, I see this code (from line 439):

    // Add the article image as enclosure
    if ($objEvent->addImage)
    {
        $objFile = \FilesModel::findByUuid($objEvent->singleSRC);

        if ($objFile !== null)
        {
            $arrEvent['enclosure'][] = $objFile->path;
        }
    }

If I have understood right, I should find the image path in $event['enclosure'] (in my cal_default.html5 template). But this key is empty.
Is this the usage of FilesModel that you referred?
Thank you

@rocchidavide

This comment has been minimized.

Show comment
Hide comment
@rocchidavide

rocchidavide May 19, 2014

Trying to do this:

<?php
  print_r(\FilesModel::findByUuid($event['singleSRC'])->path);
?>

inside cal_default.html5, I can finally obtain the file path :)

So now my questions are:

  1. is the correct mode to proceed?
  2. can this feature be added to the core? I mean, having image path directly in a key of $event

rocchidavide commented May 19, 2014

Trying to do this:

<?php
  print_r(\FilesModel::findByUuid($event['singleSRC'])->path);
?>

inside cal_default.html5, I can finally obtain the file path :)

So now my questions are:

  1. is the correct mode to proceed?
  2. can this feature be added to the core? I mean, having image path directly in a key of $event
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment