Answer the question
In order to leave comments, you need to log in
How to display images on the main screen in Yii2?
How to display pictures on the main screen? Using the extension, costa-rico was able to display images in the article itself, but it is not possible to display images on the main screen. Here is how it was deduced in the article
<?php
$mainImg=$product->getImage();
//$mainFile=$product->getImage();
$gallery=$product->getImages();
//debug($mainFile=$product->getImage());
?>
<?= Html::img($mainImg->getUrl(),['alt'=>$product->name, 'height'=>350])?>
Answer the question
In order to leave comments, you need to log in
I understand that you do not understand at all what you are doing and how everything works. This is normal for a beginner. But it means to go back and pull up what was missed. As I understand it, you need to finish learning php and stop using other people's solutions like "costa-rico" until you write your own and understand how it works. No other way.
Mistake
Call to a member function getImage() on a non-object
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question