Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
HELP - Displaying photo description for each Image in Galler

 
Post new topic   Reply to topic    Smarty Forum Index -> Help Wanted (commercial)
View previous topic :: View next topic  
Author Message
cloudjedi_
Smarty n00b


Joined: 24 Dec 2011
Posts: 1

PostPosted: Sat Dec 24, 2011 6:19 pm    Post subject: HELP - Displaying photo description for each Image in Galler Reply with quote

Would appreciate if someone can help me out. I have three fields in a database tab - PhotoName, Location & Description.
Gallery Images are loaded category wise on selection via Galleria jquery plugin.

Need to display photo description for each individual image.

URL: http://pick-a-pic.in/Category.php?category_id=1

Code below:

<link rel="stylesheet" href="http://pick-a-pic.in/css/galleria.classic.css" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>

<!-- load Galleria -->
<script src="/js/galleria-1.2.4.min.js"></script>



{literal}
<style>

/* Demo styles */
.content{color:#777;font:12px/1.4 "helvetica neue",arial,sans-serif;width:958px;margin:20px auto; margin-left: -19px;}
h1{font-size:12px;font-weight:normal;color:#ddd;margin:0;}
p{margin:0 0 20px}
a {color:#22BCB9;text-decoration:none;}
.cred{margin-top:20px;font-size:11px;}

/* This rule is read by Galleria to define the gallery height: */
#galleria{height:520px;}

</style>
{/literal}
<div class="wrapper">
<div id="container">
<div id="content">

<h2 style="margin-bottom: 5px; margin-top: -10px;">Gallery</h2>
{if $countTop gt 0} {$top.site_text} {/if}
{if $countCategoryData gt 0}
<!-- Showing the Images Now -->
{if $countCategoryImageData gt 0 }
{assign var=sn value =1}
<div class="content">
<div id="galleria">

{foreach item=categoryImage from=$categoryImageData}
<a href="{$smarty.const.SITE_URL}files/category/{$categoryImage.file_name}">
<img title=""
alt=""
src="{$smarty.const.SITE_URL}files/category/{$categoryImage.file_name}">
</a>
{/foreach}


</div>
</div>
{/if}
<br />

<!-- Showing the Categories -->

{assign var=snCategory value =1}
<table class="cat" align="left" width="60%">
<tr>

{foreach item=categoryRow from=$allCategoryData}
{if $snCategory is div by 2}
<td><a href="Category.php?category_id={$categoryRow.category_id}">{$categoryRow.category_name}</a></td></tr><tr>
{else}
<td><a href="Category.php?category_id={$categoryRow.category_id}">{$categoryRow.category_name}</a></td>
{/if}
{assign var=snCategory value =$snCategory+1}
{/foreach}
</table>
<!-- Showing the Categories -->




{else}
<p>No Images in Database</p>
{/if}
{if $countMiddle gt 0} {$middle.site_text} {/if}
{if $countBottom gt 0} {$bottom.site_text} {/if} </div>
<!-- Side Bar -->
{$sideBar}
<!-- Side Bar -->
<br class="clear" />
</div>
</div>
{literal}
<script>
// Load the classic theme
Galleria.loadTheme('/js/galleria.classic.min.js');

// Initialize Galleria
$('#galleria').galleria();

</script>


{/literal}


PHP Code

<?
/*
File-id@ index.php
contains the index or main page

*/

$admin=false;//only true when inside the admin folder
include('setting.php'); //include the basic setttings
include(BASE_PATH.'/classes/class.loader.php');
$error=""; //it is the error variable

$category_id = (isset($_GET['category_id'])) ? secure::getFilterInputBeforeInsertIntoDatabase($_GET['category_id'], true) : "";

try{

#Fetch category Info
$objCategory=new category($db);
$objCategory->_initCategory();
$objCategory->setLinkTable("category");
$objCategory->setOrderBy("category_id");
$objCategory->setSortBy("DESC");
$objCategory->setLimit("1");
$categoryData=array();
if(!empty($category_id)){
$objCategory->category_id = $category_id;
} //if(!empty($category_id))
$objCategory->getCategoryDetail();
$categoryData=$objCategory->getCategoryData();
$smarty->assign("categoryData",$categoryData);
$smarty->assign("countCategoryData",$categoryData->RecordCount());

if($categoryData->RecordCount()){
$categoryData = $categoryData->fields;



#Fetch Category Images
$objCategoryImage=new categoryImage($db);
$objCategoryImage->_initCategoryImage();
$objCategoryImage->setOrderBy("category_photo_id");
$objCategoryImage->category_id = $categoryData['category_id'];
$objCategoryImage->setSortBy("DESC");
$objCategoryImage->setLinkTable("category_photo");
$objCategoryImage->getCategoryImageDetail();
$categoryImageData =array();
$categoryImageData=$objCategoryImage->getCategoryImageData();
$smarty->assign("categoryImageData",$categoryImageData);
$smarty->assign("countCategoryImageData",$categoryImageData->RecordCount());
}


#fetch AlL category
$objCategory=new category($db);
$objCategory->_initCategory();
$objCategory->setLinkTable("category");
$objCategory->setOrderBy("category_id");
$objCategory->setSortBy("DESC");
$categoryData=array();
$objCategory->getCategoryDetail();
$allCategoryData=$objCategory->getCategoryData();
$smarty->assign("allCategoryData",$allCategoryData);
$smarty->assign("countAllCategoryData",$allCategoryData->RecordCount());


#fetch random text For Page
include(BASE_PATH.'/randomText.php');

}catch(Exception $e){
$error =$e->getMessage();
}


$content =""; //variable which will use to hold the data displayed in content
$content =$smarty->fetch('category.tpl'); //fetch the content template
$smarty->assign("content", $content); //assign content variable in smarty
$smarty->assign("error", $error);

#Display Main Form
$smarty->display('main.tpl');
?>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Help Wanted (commercial) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP