How to utilize the functions of OSClass? - php

I want to create a new .php file and I want to utilize the functions within the OSclass Codex. For instance this code won't work because I haven't imported all the functions and dependencies. How exactly do I accomplish this.
<?php osc_query_item("region_name=Madrid");
if( osc_count_custom_items() == 0) { ?>
<p class="empty"><?php _e('No Listings', 'modern') ; ?></p>
<?php } else { ?>
<table border="0" cellspacing="0">
<tbody>
<?php $class = "even"; ?>
<?php while ( osc_has_custom_items() ) { ?>
<tr class="<?php echo $class. (osc_item_is_premium()?" premium":"") ; ?>">
<?php if( osc_images_enabled_at_items() ) { ?>
<td class="photo">
<?php if( osc_count_item_resources() ) { ?>
<a href="<?php echo osc_item_url() ; ?>">
<img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="75" height="56" title="<?php echo osc_item_title(); ?>" alt="<?php echo osc_item_title(); ?>" />
</a>
<?php } else { ?>
<img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="" title=""/>
<?php } ?>
</td>
<?php } ?>
<td class="text">
<h3><?php echo osc_item_title() ; ?></h3>
<p><strong><?php if( osc_price_enabled_at_items() ) { echo osc_item_formated_price() ; ?> - <?php } echo osc_item_city(); ?> (<?php echo osc_item_region();?>) - <?php echo osc_format_date(osc_item_pub_date()); ?></strong></p>
<p><?php echo osc_highlight( strip_tags( osc_item_description() ) ) ; ?></p>
</td>
</tr>
<?php $class = ($class == 'even') ? 'odd' : 'even' ; ?>
<?php } ?>
</tbody>
</table>
<?php }; ?>

What you'll want to do is a custom page. In Osclass, custom pages are brought by plugins. If you need a tutorial about creating a plugin in Osclass 3.3+, here's one : How to create plugins for Osclass.
-
If your curious about Osclass internals, all Osclass functions (helpers) are loaded in the /oc-load.php at the root of your installation.

Related

Wordpress - strange symbol appeared beside the post thumbnail

Sorry I feel it an idiot question, but I can't fix it, those characters "> appeared beside the post thumbnail, and I don't know what's wrong there!
<?php
$notification_id = $notification->ID;
$notification_time = strtotime($notification->post_date);
$type = get_post_meta($notification_id, 'dw_notification_type', true);
$custom_type = get_post_meta($notification_id, 'dw_notification_custom_type', true);
$image = get_post_meta($notification_id, 'dw_notification_image', true);
?>
<li id="dw-notif-<?php echo $notification_id;?>" class="<?php echo dwnotif_check_user_read(false, $notification_id)?'read':'unread'; ?> <?php echo $type?$type:''; ?> <?php echo $custom_type?$custom_type:''; ?>" data-time="<?php echo $notification_time;?>">
<a href="<?php echo get_permalink($notification->ID);?>">
<div class="notif-avatar">
<?php if(has_post_thumbnail($notification->ID)): ?>
<?php echo get_the_post_thumbnail($notification->ID, 'post-thumbnail'); ?>
<?php elseif($image): ?>
<img src="<?php echo $image; ?>">
<?php else: ?>
<img src="<?php echo dwnotif_default_image(); ?>">
<?php endif; ?>
</div>
<div><?php echo $notification->post_title; ?></div>
<date class="notif-time"><?php echo human_time_diff( $notification_time, current_time('timestamp') ) . __( ' ago', 'dw-notifications' ); ?></date>
</a>
</li>

Grouped Product won't be added to cart and there is a message "Please specify the quantity of product(s)."

I am developing a store and the product I tried to add is a grouped product which I had done some design and configuration on the front end. Then, I added sample grouped product and when I click "Add to cart" , there is message "Please specify the quantity of product(s)."
Please see the website (Sorry the website is in Thai but you can try to increase the Quantity of each product and then click add to cart - Pink button)
http://www.preciosathailand.com/eyeline-0001.html
This is PHP code that I made the configuration
<?php if ($_hasAssociatedProducts): ?>
<?php foreach ($_associatedProducts as $_item): ?>
<?php $_finalPriceInclTax = $this->helper('tax')->getPrice($_item, $_item->getFinalPrice(), true) ?>
<tr>
<td width="80%"><span class="product-<?php echo $_item->getId() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></span></td>
<?php if ($this->getCanShowProductPrice($_product)): ?>
<td class="a-right">
<?php if ($this->getCanShowProductPrice($_item)): ?>
<?php echo $this->getPriceHtml($_item, true) ?>
<?php echo $this->getTierPriceHtml($_item) ?>
<?php endif; ?>
</td>
<?php endif; ?>
<?php if ($_product->isSaleable()): ?>
<td class="a-center" width="20%">
<?php if ($_item->isSaleable()) : ?>
<div class="qty-tools">
<div class="minus-qty minus-<?php echo $_item->getId() ?>"><a class="click-to-minus" id="minus-<?php echo $_item->getId() ?>" href="#" data-id-p="<?php echo $_item->getId() ?>">-</a></div>
<div class="input-qty-wrapper">
<input type="text" name="super_group[<?php echo $_item->getId() ?>]" data-qty-product-id="<?php echo $_item->getId() ?>" maxlength="12" value="<?php echo $_item->getQty()*1 ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" />
</div>
<div class="plus-qty plus-<?php echo $_item->getId() ?>"><a class="click-to-plus" href="#" id="plus-<?php echo $_item->getId() ?>" data-id-p="<?php echo $_item->getId() ?>">+</a></div>
</div>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>"><?php echo $this->__('No options of this product are available.') ?></td>
</tr>
<?php endif; ?>
This is jQuery that I have done.
jQuery(document).ready(function(){
jQuery('.click-to-minus').click(function(){
var IDInput = jQuery(this).data('id-p');
var CurrentVal = jQuery('input[name="super_group['+IDInput+']"]').val();
var minusedVal = CurrentVal-1;
jQuery('input#'+IDInput).val(minusedVal);
});
jQuery('.click-to-plus').click(function(){
var pIDInput = jQuery(this).data('id-p');
var CurrentPlusVal = jQuery('input[name="super_group['+pIDInput+']"]').val();
/* if ( CountPlus == 0){
var plusedVal = 1;
}else{
jQuery('input#'+pIDInput).val('');
var plusedVal = CurrentPlusVal+1;
}*/
var plusedVal = +CurrentPlusVal+1;
jQuery('input[data-qty-product-id="'+pIDInput+'"]').val(plusedVal);
});
});
Did I do anything wrong?
Are you trying to group configurable products, then you should know that magento doesnt allow it.
you can check this answer here

osclass specific category at home page

I am using osclass 3.1.2 version with modern theme. I have created 2 main categories paid and free which also contains one subcategory each named as premium ads and free ads. now I want to display only premium ads on my sites home page so how can I do this?
I have found this code from http://doc.osclass.org/Display_only_certain_type_of_listings
But not able to merge with my code please help.
thanks for replies. finally i have found my answer.following code is perfect solution of my problem.
<?php osc_query_item("category=99");
if( osc_count_custom_items() == 0) { ?>
<p class="empty"><?php _e('No Listings', 'modern') ; ?></p>
<?php } else { ?>
<table border="0" cellspacing="0">
<tbody>
<?php $class = "even"; ?>
<?php while ( osc_has_custom_items() ) { ?>
<tr class="<?php echo $class. (osc_item_is_premium()?" premium":"") ; ?>">
<?php if( osc_images_enabled_at_items() ) { ?>
<td class="photo">
<?php if( osc_count_item_resources() ) { ?>
<a href="<?php echo osc_item_url() ; ?>">
<img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="75" height="56" title="<?php echo osc_item_title(); ?>" alt="<?php echo osc_item_title(); ?>" />
</a>
<?php } else { ?>
<img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="" title=""/>
<?php } ?>
</td>
<?php } ?>
<td class="text">
<h3><?php echo osc_item_title() ; ?></h3>
<p><strong><?php if( osc_price_enabled_at_items() ) { echo osc_item_formated_price() ; ?> - <?php } echo osc_item_city(); ?> (<?php echo osc_item_region();?>) - <?php echo osc_format_date(osc_item_pub_date()); ?></strong></p>
<p><?php echo osc_highlight( strip_tags( osc_item_description() ) ) ; ?></p>
</td>
</tr>
<?php $class = ($class == 'even') ? 'odd' : 'even' ; ?>
<?php } ?>
</tbody>
</table>
<?php }; ?>

How to get my list of rows from database to show while using Zend-Paginator

I'm fairly new to the world of Zend-Framework, and have taken over a site that is in zend-framework. There is a bug on one of the pages right now and I can not figure it out. I think it has something to do with Zend Paginator, but not sure.
This is the code in the controller for the section I am having a problem with:
$currentPage = $this->_getParam('page');
$numWebsitesFullOnline = $websites->getWebsitesFullOnline();
$select = $websites->select();
$select->setIntegrityCheck(false);
$select->from(array('w' => 'websites'), array('id', 'online', 'kw_adjective', 'kw_name', 'kw_location', 'url', 'email', 'address', 'ftp_server', 'ftp_username', 'ftp_password', 'ftp_folder', 'phone_number', 'indexed', 'youtube_position', 'twitter_user', 'facebook_id', 'video_made', 'image1_id', 'image2_id', 'image3_id', 'bg_color', 'dark_color', 'light_color', 'links_color', 'text_color', 'google_account', 'ganalytics', 'gmaps_status', 'google_position', 'gmap_position', 'hp1', 'hp2', 'hp3', 'hp4', 'hp5', 'hp6', 'hp7', 'hp8', 'hp9', 'hp10', 'about1_id', 'about2_id', 'about3_id', 'tip1_id', 'tip2_id', 'tip3_id', 'contact_texts_id', 'quote_texts_id', 'demographics_id'))
->join(array('d' => 'demographics'), 'w.demographics_id = d.id', array('total_population'))
->order(array('total_population DESC', 'kw_location'));
$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($select));
$paginator->setItemCountPerPage(50);
$paginator->setCurrentPageNumber($currentPage);
$paginator->setPageRange(($paginator->getTotalItemCount() / 50) + 1);
$this->view->paginator = $paginator;
$numWebsitesOnline = $websites->getWebsitesOnline();
On the php page I have this code to call the websites that are in the database to a list:
<p class="red">
Websites online: <?php echo $this->numOnline; ?>
</p>
<?php print_r(count($this->paginator)); ?>
<?php if(count($this->paginator)): ?>
<table class="table-list">
<?php foreach($this->paginator as $item): ?>
<tr>
<?php if($this->userIsAllowedAction('websites', 'reload')): ?>
<td class="center noborder w30">
<img class="hidden" src="<?php echo $this->baseUrl() . '/images/loader.gif' ?>" alt="Loading..."/><a class="reload" title="refresh" href="<?php echo $this->baseUrl(); ?>/utils/ui/refresh-website.php" rel="<?php echo urlencode('http://' . $item['url'] . '/install.php'); ?>,<?php echo urlencode($item['ftp_server']); ?>,<?php echo $item['ftp_username']; ?>,<?php echo $item['ftp_password']; ?>,<?php echo $item['ftp_folder']; ?>,<?php echo $this->baseUrl(); ?>,<?php echo $item['id']; ?>"><img src="<?php echo $this->baseUrl(); ?>/images/icon-refresh.png" alt="Refresh"/></a>
</td>
<?php endif; ?>
<td class="center noborder w30">
<?php if($this->userIsAllowedAction('websites', 'edit')): ?><a title="Edit" href="<?php echo $this->url(array('controller' => 'websites', 'action' => 'edit', 'id' => $item['id'])); ?>"><img src="<?php echo $this->baseUrl(); ?>/images/icon-edit.png" alt="Edit"/></a><?php endif; ?>
</td>
<td class="center noborder w30">
<?php if($this->userIsAllowedAction('websites', 'remove')): ?><a title="Remove" href="<?php echo $this->url(array('controller' => 'websites', 'action' => 'remove', 'id' => $item['id'])); ?>"><img src="<?php echo $this->baseUrl(); ?>/images/icon-delete.png" alt="Remove"/></a><?php endif; ?>
</td>
<td>
<?php if($item['online']): ?>
<span class="hidden"><?php echo trim($this->escape($item['kw_adjective'] . $item['kw_name'])); ?></span><a class="goto-website" href="http://<?php echo $item['url']; ?>" target="_blank"><?php echo $this->escape($item['kw_location']); ?></a>
<?php else: ?>
<?php echo $this->escape($item['kw_location']); ?>
<?php endif; ?>
</td>
<td class="center population">
<?php if($item['total_population'] >= 0) echo $item['total_population']; ?>
</td>
<td class="center">
<?php if(!empty($item['url'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if(!empty($item['email'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if($item['demographics_id']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if($item['hp1'] && $item['hp2'] && $item['hp3'] && $item['hp4'] && $item['hp5'] && $item['hp6'] && $item['hp7'] && $item['hp8'] && $item['hp9'] && $item['hp10'] && $item['about1_id'] && $item['about2_id'] && $item['about3_id'] && $item['tip1_id'] && $item['tip2_id'] && $item['tip3_id'] && $item['contact_texts_id'] && $item['quote_texts_id']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if(file_exists($_SERVER['DOCUMENT_ROOT'] . $this->baseUrl() . Zend_Registry::get('assets_base_path') . '/' . $item['id'] . '/header.jpg')): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php
if(($item['bg_color'] != '' && $item['bg_color'] != 'e6e6e6')
|| ($item['dark_color'] != '' && $item['dark_color'] != '003e75')
|| ($item['light_color'] != '' && $item['light_color'] != '3073ad')
|| ($item['links_color'] != '' && $item['links_color'] != '255593')
|| ($item['text_color'] != '' && $item['text_color'] != '4f4f4f')):
?>
<img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/>
<?php endif; ?>
</td>
<td class="center">
<?php if($item['image1_id'] && $item['image2_id'] && $item['image3_id']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if(!empty($item['twitter_user'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if(!empty($item['facebook_id'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if(!empty($item['phone_number'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if($item['google_account']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if($item['video_made']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if($item['youtube_position']) { echo $item['youtube_position']; }; ?>
</td>
<td class="center">
<?php if(!empty($item['address'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if($item['gmaps_status'] == 1): ?><img src="<?php echo $this->baseUrl(); ?>/images/icon-gmapspending.png" alt="Pending"/><?php elseif($item['gmaps_status'] == 2): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if(!empty($item['ganalytics'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?>
</td>
<td class="center">
<?php if($item['online']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark_red.png" alt="Online!"/><?php endif; ?>
</td>
<td class="center">
<?php if($item['indexed']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark_red.png" alt="Online!"/><?php endif; ?>
</td>
<td class="center">
<?php if($item['gmap_position']) { echo $item['gmap_position']; }; ?>
</td>
<td class="center">
<?php if($item['google_position']) { echo $item['google_position']; }; ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
The print_r(count($this->paginator)); line is returning "0", and the $this->numOnline; line is returning 1. So it sees that there is one row in the websites table of the database, but it is not returning anything to page and listing out the rows in the websites table. Not sure if this is the paginator that is causing this cause it is returning 0 or something else I don't know about.
I'm not sure about that, but try to use joinLeft instead of join, maybe it's just the relation between websites table and demographics table who is making this result.

take first result of php foreach and carry on

This is a very difficult question to ask but, lets try. I am using this module for joomla i need tocreate an overide for it so that it takes the first result of
<?php foreach( $pages as $key => $list ): ?>
and places it in its own div and carries on with the statement. Please ask if any other information is needed here's the entire code for the override:
<?php
/**
* #package mod_bt_contentslider - BT ContentSlider Module
* #version 1.4
* #created Oct 2011
* #author BowThemes
* #email support#bowthems.com
* #website http://bowthemes.com
* #support Forum - http://bowthemes.com/forum/
* #copyright Copyright (C) 2012 Bowthemes. All rights reserved.
* #license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
if($modal){JHTML::_('behavior.modal');}
$document = JFactory::getDocument();
if(count($list)>0){?>
<div id="btcontentslider<?php echo $module->id; ?>" style="display:none;" class="span4 bt-cs<?php echo $moduleclass_sfx? ' bt-cs'.$params->get('moduleclass_sfx'):'';?>">
<!--CONTENT-->
<div class="slides_container" style="width:<?php echo $moduleWidth.";".$add_style;?>">
<?php foreach( $pages as $key => $list ): ?>
<div class="slide" style="width:100%;">
<?php foreach( $list as $i => $row ): ?>
<ul class="bt-row <?php if($i==0) echo 'bt-row-first'; else if($i==count($list)-1) echo 'bt-row-last' ?>" style="width:100%" >
<li class="bt-inner">
<?php if( $row->thumbnail && $align_image != "center"): ?>
<a target="<?php echo $openTarget; ?>" class="bt-image-link<?php echo $modal? ' modal':''?>" title="<?php echo $row->title;?>" href="<?php echo $modal?$row->mainImage:$row->link;?>">
<img <?php echo $imgClass ?> src="<?php echo $row->thumbnail; ?>" alt="<?php echo $row->title?>" style="width:<?php echo $thumbWidth ;?>px; float:<?php echo $align_image;?>;margin-<?php echo $align_image=="left"? "right":"left";?>:5px" title="<?php echo $row->title?>" />
</a>
<?php endif; ?>
<?php if( $showTitle ): ?>
<a class="bt-title" target="<?php echo $openTarget; ?>"
title="<?php echo $row->title; ?>"
href="<?php echo $row->link;?>"> <?php echo $row->title_cut; ?> </a><br />
<?php endif; ?>
<?php if( $row->thumbnail && $align_image == "center" ): ?>
<div class="bt-center">
<a target="<?php echo $openTarget; ?>"
class="bt-image-link<?php echo $modal? ' modal':''?>"
title="<?php echo $row->title;?>" href="<?php echo $modal?$row->mainImage:$row->link;?>">
<img <?php echo $imgClass ?> src="<?php echo $row->thumbnail; ?>" alt="<?php echo $row->title?>" style="width:<?php echo $thumbWidth ;?>px;" title="<?php echo $row->title?>" />
</a>
</div>
<?php endif ; ?>
<?php if( $show_intro ): ?>
<div class="bt-introtext">
<?php echo $row->description; ?>
</div>
<?php endif; ?>
<?php if( $showReadmore ) : ?>
<p class="readmore">
<a target="<?php echo $openTarget; ?>"
title="<?php echo $row->title;?>"
href="<?php echo $row->link;?>"> <?php echo JText::_('READ_MORE');?>
</a>
</p>
<?php endif; ?>
</li>
<!--end bt-inner -->
</ul>
<!--end bt-row -->
<!--CONTENT-->
<?php endforeach; ?>
<div style="clear: both;"></div>
</div>
<!--end bt-main-item page -->
<?php endforeach; ?>
</div>
<?php if( $next_back && $totalPages > 1 ) : ?>
<a class="prev" href="#"></a><a class="next" href="#"></a>
<?php endif; ?>
</div>
<!--end bt-container -->
<div style="clear: both;"></div>
<script type="text/javascript">
if(typeof(btcModuleIds)=='undefined'){var btcModuleIds = new Array();var btcModuleOpts = new Array();}
btcModuleIds.push(<?php echo $module->id; ?>);
btcModuleOpts.push({
slideEasing : '<?php echo $slideEasing; ?>',
fadeEasing : '<?php echo $slideEasing; ?>',
effect: '<?php echo $effect; ?>',
preloadImage: '<?php echo $preloadImg; ?>',
generatePagination: <?php echo $paging ?>,
play: <?php echo $play; ?>,
hoverPause: <?php echo $hoverPause; ?>,
slideSpeed : <?php echo $duration; ?>,
autoHeight:<?php echo $autoHeight ?>,
fadeSpeed : <?php echo $fadeSpeed ?>,
equalHeight:<?php echo $equalHeight; ?>,
width: <?php echo $moduleWidth=='auto'? "'auto'":$params->get( 'module_width', 0 ); ?>,
height: <?php echo $moduleHeight=='auto'? "'auto'":$params->get( 'module_height', 0 ); ?>,
pause: 100,
preload: true,
paginationClass: '<?php echo $butlet==1 ? 'bt_handles': 'bt_handles_num' ?>',
generateNextPrev:false,
prependPagination:true,
touchScreen:<?php echo $touchScreen ?>
});
</script>
<?php
// set position for bullet
if($butlet) {
$nav_top = (-1)*(int)$params->get( 'navigation_top', 0 );
$nav_right = (-1)*(int)$params->get( 'navigation_right', 0 )+5;
if(trim($params->get('content_title'))) $nav_top += 13;
$document->addStyleDeclaration(
$modid . ' ' . ($butlet == 1 ? '.bt_handles' : '.bt_handles_num') . '{'.
'bottom: ' . '5% !important;'.
'right: ' . '50% !important'.
'}'
);
}
// set responsive for mobile device
if($moduleWidth=='auto'){
$document->addStyleDeclaration(
'
#media screen and (max-width: 480px){.bt-cs .bt-row{width:100%!important;}}'
);
}
}
else
{
echo '<div>No result...</div>';
} ?>
Any Help Greatly apreciated.
you can do something like this. basicly, set a boolean to only do something different to the first item:
<?php $first = true; ?>
<?php foreach( $pages as $key => $list ): ?>
<?php
if($first) {
/* put this $list in its own div or whatever you need to do */
$first = false;
} else {
... //the default operation/code
?>
...
<?php } ?>
<?php endforeach; ?>
Complete Edit:
Use a counter to know which iteration it is:
<?php $c = 0; // initialize counter
foreach( $pages as $key => $list ):
if ($c++ == 0):
?>
this section will only run for the first element.
<?php endif;?>

Categories