Of course, having our images uploaded is just the first step, now we need to
show these images, but this is not going to be that hard. Open the
components/com_tinynews/views/tinynews/tmpl/default.php
file, and add
the following code:
<div class="news_box"> <?php if(!empty($new->image)){ ?> <img src="<?php JURI::base(); ?>administrator/components/ com_tinynews/images/<?php echo $new->image; ?>" alt="<?php echo $new->caption; ?>" width="165px"/> <p><?php echo $new->caption; ?></p> <?php } ?> <h1><?php echo $new->title; ?></h1>
First, if we have some data in the image field, we prepare the
img
tag. Note that after the JURI::base()
; method
we have added administrator
, but when we were working in the
admin part, this wasn't needed. The JURI::base()
; method will
distinguish where we are.
At this point, with the images included, our site will look better. The next screenshot...