Jump to content

Recommended Posts

Hi all... First, as I stated, I'm a complete php novice, so excuse my elementary approach to my question.  Here goes...

 

I have price packages set up for placing a listing on my site which uses the code below to display them like so:

 

post-156326-0-04457400-1370183055_thumb.jpg

             
			$uri =  end(explode('?', $_SERVER['REQUEST_URI']));
			$uri = explode('&pkg=', $uri);
			//echo $uri[0];
			  	 $property_price_info = get_property_price_info();
				 if($property_price_info)
				 {
				 ?>

			  <div class="form_row clearfix <?php if($_REQUEST['upgrade']){echo 'upgrade_highlight';} ?>" >
                <?php get_price_info($price_select,$package_pid,$uri[0]);?> 
             	                
             </div>
			

However, I want to be able to style the output to make it look like the image below, but I have no idea how to go about doing so.  I'm not concerned with the verbiage difference (I just made an example to show you), I just need help figuring out how to make package 1, 2 and 3 show up on one line, then 4, 5 and 6 on the next, then 7, 8 and 9 on the next, etc. so that I can style the rows differently.

 

post-156326-0-76863100-1370183202_thumb.jpg

 

Thanks in advance for your help!

Link to comment
https://forums.phpfreaks.com/topic/278686-novice-needs-coding-help/
Share on other sites

The code you've posted doesn't demonstrate anything to do with output.

 

What you're asking is a very simple thing. Select your categories, then for each one list the three options. Zebra-striping is another easy concept, you can find tutorials for that by googling.

As I stated, I'm just a novice...sorry!  I believe THIS is the code that needs to be changed:

function get_price_info($title='',$package_pid, $uri)
{
	global $price_db_table_name,$wpdb;
	add_column_if_not_exist($price_db_table_name, 'sort_order');
	$pricesql = "select * from $price_db_table_name where status=1 and post_type='listing' ORDER BY sort_order,pid";
	$priceinfo = $wpdb->get_results($pricesql);
	if($title==''){$title=$package_pid;}
	if($priceinfo)
	{
		$counter=1;
		foreach($priceinfo as $priceinfoObj)
		{
			if(stripslashes($priceinfoObj->title_desc))
			{
			?>
            <div class="package"><input type="radio" value="<?php echo $priceinfoObj->pid;?>" <?php if($title==$priceinfoObj->pid ){ echo 'checked="checked"';}?> name="price_select" id="price_select<?php echo $counter ?>"  onclick="window.location.href='<?php echo home_url();?>/?<?php echo $uri; ?>&pkg=<?php echo $priceinfoObj->pid;?>'+user_val" /> <?php echo stripslashes($priceinfoObj->title_desc);?></div>
        <?php
			}else
			{
		?>
         <div class="package"><input type="radio" value="<?php echo $priceinfoObj->pid;?>" <?php if($title==$priceinfoObj->pid ){ echo 'checked="checked"';}?> name="price_select" id="price_select<?php echo $counter ?>" onclick="window.location.href='<?php echo home_url();?>/?<?php echo $uri; ?>&pkg=<?php echo $priceinfoObj->pid;?>'+user_val" /> <?php printf(__(PUBLISH_DAYS_TEXT),$priceinfoObj->title,$priceinfoObj->days,str_replace(' ','_',$priceinfoObj->title),$priceinfoObj->amount,get_currency_type());?></div>
        <?php		
			}
		?>
        <?php $counter++;
		}
	}
}

Does anyone know what I would change to show the first 3 entries in a row, then the next 3, and so on instead of one per line? 

I have no idea whatsoever and REALLY, REALLY need some help...

Thanks to everyone in advance!!!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.