icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » Need some help here please!!!

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old October 23rd, 2004, 3:22 PM   #28 (permalink)
Surpass Fan
Comfy Contributor
 
pbflash's Avatar
 
Joined in Sep 2004
209 posts
Gave thanks: 0
Thanked 0 times
It should actually be this. I don't know where that BEGIN__VBULLETIN__CODE__SNIPPET came from.

PHP Code:
<?php 
loop images 

    if(
$c%$cols==0) { echo '<tr>';} 
    
?> 
    <td align="center"><a href="<?php echo sefRelToAbs('index.php?option=com_hotproperty&task=view&id='.$f->id.'&Itemid='.$Itemid); ?>"><?php echo '<img '.$thumb_imgsize[3].' border="0" src="'.$mosConfig_live_site."/".$hp_imgdir_thumb.((!empty($thumb->thumb)) ? $thumb->thumb $hp_img_noimage_thumb).'" alt="'.$thumb->title.'">'?><br /> 
    <?php echo $f->name?></a></td> 
    <?php 
    $c
++; 
    if(
$c%$cols==0) { echo '</tr>';} 

?> 
</table>
__________________
Pass14
www.tqwebservices.com
www.autoappraisalsunlimited.com
www.clevelandlayne.com
Pass18
www.estateagency.com.au

Some people drink deeply from the fountain of knowledge. Others just gargle.
pbflash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 24th, 2004, 12:16 AM   #29 (permalink)
Registered User
Comfy Contributor
 
blaze's Avatar
 
Joined in Aug 2004
Lives in Las Vegas
Hosted on pass11, pass12
187 posts
Gave thanks: 0
Thanked 0 times
Let me say thanks first -- as I really appreciate your help with this.

Okay, I am now getting a new error:

Parse error: parse error, unexpected T_STRING in /home/*****/public_html/modules/mod_hp_featuredprop_wpic.php on line 73

Line error reads: loop images {

So there is no confusion, here is the current code I am using:

PHP Code:
<?php

/**
* Hot Property's Featured Property Module with Pictures
*
* [at]package Hot Property 0.9
* [at]copyright (C) 2004 Lee Cher Yeong
* [at]url [url]http://www.Mosets.com/[/url]
* [at]author Lee Cher Yeong <cy[at]mosets.com>
**/

defined'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

# Include the config file
require( $mosConfig_absolute_path.'/administrator/components/com_hotproperty/config.hotproperty.php' );

# Include the language file. Default is English
if ($hp_language=='') {
    
$hp_language='english';
}
include_once(
'components/com_hotproperty/language/'.$hp_language.'.php');

# Get params
$count intval$params->get'count') );
$direction $params->get'direction''vertical' );

# Get total number of published featured items
$database->setQuery"SELECT COUNT(*) AS total FROM #__hp_properties AS p"
    
"\nLEFT JOIN #__hp_prop_types AS t ON t.id=p.type"
    
.    "\nWHERE p.published=1 AND p.approved=1 AND t.published=1"
    
"\n AND p.featured=1"
    
"\n    AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= NOW())"
    
"\n    AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= NOW())");
$total $database->loadResult();

# Get Itemid, determine if the HP component is published
$database->setQuery("SELECT id FROM #__menu"
    
.    "\nWHERE link='index.php?option=com_hotproperty'"
    
.    "\nLIMIT 1");
$Itemid $database->loadResult();

# Get all featured property
$database->setQuery"SELECT p.* FROM #__hp_properties AS p"
        
"\nLEFT JOIN #__hp_prop_types AS t ON p.type = t.id"
        
"\nLEFT JOIN #__hp_featured AS f ON f.property = p.id"
        
"\nWHERE p.published='1' AND p.approved='1' AND t.published='1'"
        
"\n    AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= NOW())"
        
"\n    AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= NOW())"
        
.    "\nAND p.featured='1'"
        
"\nORDER BY RAND()"
        
"\nLIMIT 0, ".$count );
    
$featured $database->loadObjectList();
?> 
$cols=6; 
$c=0; //counter 
<table cellpadding="1" cellspacing="1" border="0" width="100%">
<?php foreach($featured AS $f) { 
    unset(
$thumb); 
    
# Get the first thumbnail of the property 
    
$database->setQuery"SELECT thumb, title FROM #__hp_photos" 
        
"\nWHERE property='".$f->id."'" 
        
"\nORDER BY ordering ASC" 
        
"\nLIMIT 0,1"); 
    
$database->loadObject($thumb); 

    if (
$thumb->thumb <> '') { 
        
$thumb_imgsize GetImageSize ($mosConfig_absolute_path.$hp_imgdir_thumb.$thumb->thumb); 
    } else { 
        
$thumb_imgsize GetImageSize ($mosConfig_absolute_path.$hp_imgdir_thumb.$hp_img_noimage_thumb); 
    } 
?>    
<?php 
loop images 

    if(
$c%$cols==0) { echo '<tr>';} 
?> 
    <td align="center"><a href="<?php echo sefRelToAbs('index.php?option=com_hotproperty&task=view&id='.$f->id.'&Itemid='.$Itemid); ?>"><?php echo '<img '.$thumb_imgsize[3].' border="0" src="'.$mosConfig_live_site."/".$hp_imgdir_thumb.((!empty($thumb->thumb)) ? $thumb->thumb $hp_img_noimage_thumb).'" alt="'.$thumb->title.'">'?><br /> 
    <?php echo $f->name?></a></td> 
    <?php 
    $c
++; 
    if(
$c%$cols==0) { echo '</tr>';} 

?> 
</table>
 
<?php if ($total $count) { 
echo 
'<a href="' 
    
.    sefRelToAbs('index.php?option=com_hotproperty&task=viewfeatured&Itemid='.$Itemid
    .    
'">'._HP_MOREFEATURED.'</a>'
     
?>
__________________
-- BlaZe --
............
blaze is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 24th, 2004, 12:22 AM   #30 (permalink)
Surpass Fan
Comfy Contributor
 
pbflash's Avatar
 
Joined in Sep 2004
209 posts
Gave thanks: 0
Thanked 0 times
Delete lines 73 and 81.
__________________
Pass14
www.tqwebservices.com
www.autoappraisalsunlimited.com
www.clevelandlayne.com
Pass18
www.estateagency.com.au

Some people drink deeply from the fountain of knowledge. Others just gargle.
pbflash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 24th, 2004, 12:33 AM   #31 (permalink)
Registered User
Comfy Contributor
 
blaze's Avatar
 
Joined in Aug 2004
Lives in Las Vegas
Hosted on pass11, pass12
187 posts
Gave thanks: 0
Thanked 0 times
Okay, so that we know I deleted the correct lines, I deleted:

73 loop images {
81 }


Now I get this error:

Parse error: parse error, unexpected $ in /home/******/public_html/modules/mod_hp_featuredprop_wpic.php on line 90

line 90 currently reads: } ?>
__________________
-- BlaZe --
............
blaze is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 24th, 2004, 12:42 AM   #32 (permalink)
Registered User
Comfy Contributor
 
blaze's Avatar
 
Joined in Aug 2004
Lives in Las Vegas
Hosted on pass11, pass12
187 posts
Gave thanks: 0
Thanked 0 times
Okay, I added } at the end of line 88 which NOW reads:

PHP Code:
.    '">'._HP_MOREFEATURED.'</a>';} 
This got the script to work -- however, the pictures are aligning vertically now. They line up as 4 in a row, and then scatter EVERYWHERE throughout the page -- on the left side, towards the bottom -- almost like they are on layers. There are 12 thumbs right now.
__________________
-- BlaZe --
............

Last edited by blaze; October 24th, 2004 at 12:45 AM..
blaze is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 24th, 2004, 12:46 AM   #33 (permalink)
Surpass Fan
Comfy Contributor
 
pbflash's Avatar
 
Joined in Sep 2004
209 posts
Gave thanks: 0
Thanked 0 times
I thought there was going to be a problem with the layout. Let me go through it and try to straighten it out.
__________________
Pass14
www.tqwebservices.com
www.autoappraisalsunlimited.com
www.clevelandlayne.com
Pass18
www.estateagency.com.au

Some people drink deeply from the fountain of knowledge. Others just gargle.
pbflash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 24th, 2004, 12:48 AM   #34 (permalink)
Registered User
Comfy Contributor
 
blaze's Avatar
 
Joined in Aug 2004
Lives in Las Vegas
Hosted on pass11, pass12
187 posts
Gave thanks: 0
Thanked 0 times
Also, so that you know -- In the program on the backend, I have a choice to display the thumbs vertically or hozizontally -- I chose horizontal. This is why I wanted 6 thumbs across and then show a new row when it hits 6 thumbs, to start a new line break so to speak so it stays within a table of 420px. Perhaps I need to add the code I originally had that stated:

PHP Code:
<?php if ($direction == 'horizontal') echo "<tr>"?>
__________________
-- BlaZe --
............
blaze is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 24th, 2004, 12:51 AM   #35 (permalink)
Surpass Fan
Comfy Contributor
 
pbflash's Avatar
 
Joined in Sep 2004
209 posts
Gave thanks: 0
Thanked 0 times
Hopefully this will do it. You don't need the direction code. It had to be overwritten to get the count to work right.

PHP Code:
<?php 

/** 
* Hot Property's Featured Property Module with Pictures 

* [at]package Hot Property 0.9 
* [at]copyright (C) 2004 Lee Cher Yeong 
* [at]url [url]http://www.Mosets.com/[/url] 
* [at]author Lee Cher Yeong <cy[at]mosets.com> 
**/ 

defined'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 

# Include the config file 
require( $mosConfig_absolute_path.'/administrator/components/com_hotproperty/config.hotproperty.php' ); 

# Include the language file. Default is English 
if ($hp_language=='') { 
    
$hp_language='english'

include_once(
'components/com_hotproperty/language/'.$hp_language.'.php'); 

# Get params 
$count intval$params->get'count') ); 
$direction $params->get'direction''vertical' ); 

# Get total number of published featured items 
$database->setQuery"SELECT COUNT(*) AS total FROM #__hp_properties AS p" 
    
"\nLEFT JOIN #__hp_prop_types AS t ON t.id=p.type" 
    
.    "\nWHERE p.published=1 AND p.approved=1 AND t.published=1" 
    
"\n AND p.featured=1" 
    
"\n    AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= NOW())" 
    
"\n    AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= NOW())"); 
$total $database->loadResult(); 

# Get Itemid, determine if the HP component is published 
$database->setQuery("SELECT id FROM #__menu" 
    
.    "\nWHERE link='index.php?option=com_hotproperty'" 
    
.    "\nLIMIT 1"); 
$Itemid $database->loadResult(); 

# Get all featured property 
$database->setQuery"SELECT p.* FROM #__hp_properties AS p" 
        
"\nLEFT JOIN #__hp_prop_types AS t ON p.type = t.id" 
        
"\nLEFT JOIN #__hp_featured AS f ON f.property = p.id" 
        
"\nWHERE p.published='1' AND p.approved='1' AND t.published='1'" 
        
"\n    AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= NOW())" 
        
"\n    AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= NOW())" 
        
.    "\nAND p.featured='1'" 
        
"\nORDER BY RAND()" 
        
"\nLIMIT 0, ".$count ); 
    
$featured $database->loadObjectList(); 
?> 
$cols=6; 
$c=0; //counter 
<table cellpadding="1" cellspacing="1" border="0" width="100%"> 
<tr>
<?php foreach($featured AS $f) { 
    unset(
$thumb); 
    
# Get the first thumbnail of the property 
    
$database->setQuery"SELECT thumb, title FROM #__hp_photos" 
        
"\nWHERE property='".$f->id."'" 
        
"\nORDER BY ordering ASC" 
        
"\nLIMIT 0,1"); 
    
$database->loadObject($thumb); 

    if (
$thumb->thumb <> '') { 
        
$thumb_imgsize GetImageSize ($mosConfig_absolute_path.$hp_imgdir_thumb.$thumb->thumb); 
    } else { 
        
$thumb_imgsize GetImageSize ($mosConfig_absolute_path.$hp_imgdir_thumb.$hp_img_noimage_thumb); 
    } 
?>     
<?php 

    
if($c%$cols==0) { echo '<tr>';} 
?> 
    <td align="center"><a href="<?php echo sefRelToAbs('index.php?option=com_hotproperty&task=view&id='.$f->id.'&Itemid='.$Itemid); ?>"><?php echo '<img '.$thumb_imgsize[3].' border="0" src="'.$mosConfig_live_site."/".$hp_imgdir_thumb.((!empty($thumb->thumb)) ? $thumb->thumb $hp_img_noimage_thumb).'" alt="'.$thumb->title.'">'?>
    <?php echo $f->name?></a></td> 
    <?php 
    $c
++; 
    if(
$c%$cols==0) { echo '</tr>';} 

?> 
</table> 

<?php if ($total $count) { 
echo 
'<a href="' 
    
.    sefRelToAbs('index.php?option=com_hotproperty&task=viewfeatured&Itemid='.$Itemid
    .    
'">'._HP_MOREFEATURED.'</a>';}
      
?>
__________________
Pass14
www.tqwebservices.com
www.autoappraisalsunlimited.com
www.clevelandlayne.com
Pass18
www.estateagency.com.au

Some people drink deeply from the fountain of knowledge. Others just gargle.
pbflash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 24th, 2004, 12:52 AM   #36 (permalink)
Registered User
Comfy Contributor
 
blaze's Avatar
 
Joined in Aug 2004
Lives in Las Vegas
Hosted on pass11, pass12
187 posts
Gave thanks: 0
Thanked 0 times
Do you know anything about modulo division? This other guy told me wrapping is done by Modulo division -- whatever that means. Anyway, here is his code:

PHP Code:
// put this at the top of the page and change as needed
$num_to_wrap_at 4;
// put this code in your loop through images
$cnt++;
if (
$cnt $num_to_wrap_at == 0){
   echo 
"<br>";
}
?> 

What do you think?
__________________
-- BlaZe --
............
blaze is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On