Book Image

Joomla! 1.5 JavaScript jQuery

Book Image

Joomla! 1.5 JavaScript jQuery

Overview of this book

Ever wondered how all the great-looking, feature packed, amazing Joomla! sites are made? Would you like to add image transitions, popups, scrolls, AJAX forms, image galleries, no-page reloads to your website, but are worried that they will be difficult to implement? To make any Joomla! site look more professional, interactive, and interesting you need the ease and power of jQuery.This book will help you to use the jQuery library with the Joomla! CMS. It will take you through adding jQuery functionality to the Joomla! CMS and show how to use it to make the modules and themes more dynamic, interactive, and responsive, and add effects to your Joomla! site.The book starts by showing a plain Joomla! site without any JavaScript enhancement or features, then accompanies you through the process of site enhancement.First you will learn how to make use of third-party extensions to include jQuery features into your site. These can be image galleries, jQuery powered menus, tooltips, and many, many more. Later on you will learn how to modify your template to add some features to your Joomla! site, You will also learn to build your own jQuery-powered Joomla! extensions, and how to pack them so that you can use them in any project you like. Further, you will learn to create your own modules and components.By the end of this book, you will have learned how to enhance any Joomla! site with JavaScript and jQuery.
Table of Contents (16 chapters)
Joomla! 1.5 JavaScript jQuery
Credits
About the Author
About the Reviewers
Preface
Index

Showing our images in the frontend


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...