Jump to content

Search the Community

Showing results for tags 'category'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 9 results

  1. I want to display 10 products from each category from database, I started to display the categories but how to make displaying the products from each one. Here is the code I make so far. I'm not sure am I doing it right with doble sql select , or it can be done only with one. <div class="inner shadow"> <?php $query = 'SELECT id, title_bg AS `title_cat` FROM categories'; $result = $this->db->query($query); ?> <?php foreach ($result->result() as $row): ?> <?php $title_cat = stripslashes($row->title_cat); ?> <div class="prod-sec"> <div class="prod-head"> <h2><?= $title_cat?></h2> <div class="clear"></div> </div> <?php $query1 = 'SELECT t1.id, t1.title_bg AS `Title`, t1.text_bg AS `Text`, t1.price, t1.discount, t1.category_id, t1.promo_page, t2.id AS FileID, t2.ext, FROM products t1 LEFT JOIN products_pictures t2 ON t1.id = t2.object_id LEFT JOIN categories t3 ON t3.id = t1.category_id WHERE t1.promo_page = 0 AND t1.is_active = 1 AND t3.title_bg = '$title_cat' ORDER BY RAND() LIMIT 10'; $result1 = $this->db->query($query1); ?> <div id="classeslist2"> <ul class="home_middle_products"> <?PHP foreach($result1->result() as $row1) { $f = 'files/products_first_page/' . $row1->id . '.jpg'; if(is_file(dirname(__FILE__) . '/../../' . $f)) { $img = site_url() . "files/products_first_page/".$row1->id.".jpg"; } else { $img = site_url() . "files/products/".$row1->id."/".$row1->FileID."_2.".$row1->ext; } $title = stripslashes($row1->Title); $text = character_limiter(strip_tags(stripslashes($row1->Text)),250); $title_url = getLinkTitle($title); $link = site_url()."products/product/".$row1->id."/{$title_url}"; ?> <li style="width: 185px; height: 270px; margin-left: 3px; margin-top: 10px;"> <div class="thumb"> <a href="<?=$link?>"><img src="<?=$img?>" alt="<?=$title?>" width="182" /></a> <div class="price"><?PHP echo product_price($row1, array('show_discount' => false,"show_old_price"=>false, 'show_label' => false, 'view' => 'no')); ?> </div> </div> <h2></h2> <h2><a href="<?=$link?>"><?=$title?></a></h2> <? $text = substr($text, 0, 100); ?> <? if (strlen($text) == 100) $text .= '...' ; ?> <p><?=$text?></p> </li> <?php } ?> <div class="clear"></div> </ul> </div> </div> <?php endforeach; ?> <div class="clear"></div> </div>
  2. Hello Community, I have some diffuclties about getting the right logic for article management with subcategories. So everything with Categorys is fine. TABLE: articles articleID title content cat_relatedID TABLE: categories catID cat_name On submit it Works fine where in "selection option" I can select the Category for that post. Now I want to extend it with subcategories. TABLE: articles articleID title content cat_relatedID TABLE: categories catID cat_name TABLE: subcategories subcatID subcat_name related_catID Now the problem is how to relate Cats and Subcats in the form where I am adding new Articles and submit it to mysql. Do I need a additional field in the article table subcatID or anything else? My logic is something to make like in Wordpress when adding New posts you have the option to check categories related with that post. <ul class="list-unstyled categorychecklist "> <li><input type="checkbox" value=""> Category 1 <ul class="children"> <li><input type="checkbox" value=""> Subcategory 1</li> <li><input type="checkbox" value=""> Subcategory 2</li> <li><input type="checkbox" value=""> Subcategory 3</li> </ul> </li> <li><input type="checkbox" value=""> Category 2 <ul class="children"> <li><input type="checkbox" value=""> Subcategory 4</li> <li><input type="checkbox" value=""> Subcategory 5</li> <li><input type="checkbox" value=""> Subcategory 6</li> </ul> </li> <li><input type="checkbox" value=""> Category 3 - No subcategories</li> </ul> LINK should look something like this example: mylink.com/category.php?ID=12&sub_ID=15 Image attached is how it looks now.
  3. I am developing a eCommerce website for college semester project,but i am facing a problem with product variant. I want to create different variant and feature depending on products category with filtration. Example: http://www.flipkart.com/mobiles/samsung~brand/pr?sid=tyy,4io&otracker=ch_vn_mobile_filter_Top%20Brands_Samsung Please help me how to create table and fetch the data. Thanks...
  4. Hi All, I'm currently trying to find a solution to a problem within a wordpress template I am using. On the homepage, Im using a widget to display recent posts. However, the widget displays all posts, whereas I want it to only display posts from a particular category. What do I need to edit within the php to make this happen? Heres the widget php: <?php /** * List Blog Posts * * @since Jobify 1.0 */ class Jobify_Widget_Blog_Posts extends Jobify_Widget { /** * Constructor */ public function __construct() { $this->widget_cssclass = 'jobify_widget_blog_posts'; $this->widget_description = __( 'Jobify - Display recent blog posts.', 'jobify' ); $this->widget_id = 'jobify_widget_blog_posts'; $this->widget_name = __( 'Jobify - Home: Blog Posts', 'jobify' ); $this->settings = array( 'title' => array( 'type' => 'text', 'std' => __( 'Recent News Article', 'jobify' ), 'label' => __( 'Title:', 'jobify' ) ), 'description' => array( 'type' => 'textarea', 'rows' => 4, 'std' => '', 'label' => __( 'Description:', 'jobify' ), ) ); parent::__construct(); } /** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget( $args, $instance ) { if ( $this->get_cached_widget( $args ) ) return; ob_start(); extract( $args ); $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); $description = $instance[ 'description' ]; $posts = new WP_Query( apply_filters( 'widget_jobify_blog_posts', array( 'posts_per_page' => 3, 'ignore_sticky_posts' => true ) ) ); echo $before_widget; ?> <div class="container"> <?php if ( $title ) echo $before_title . $title . $after_title; ?> <?php if ( $description ) : ?> <p class="homepage-widget-description"><?php echo $description; ?></p> <?php endif; ?> <div class="content-grid row"> <?php if ( $posts->have_posts() ) : ?> <?php while ( $posts->have_posts() ) : $posts->the_post(); ?> <?php get_template_part( 'content', 'grid' ); ?> <?php endwhile; ?> <?php endif; ?> </div> </div> <?php echo $after_widget; $content = apply_filters( 'jobify_widget_blog_posts', ob_get_clean(), $instance, $args ); echo $content; $this->cache_widget( $args, $content ); } }
  5. Hi everyone, newbie to site looking for help with my tag/category page formatting. I recently bought a plugin for masonry and have been trying to make it the display for posts on my blog pages as you can see here: http://www.enduringepilepsy.com/_blog/ and http://www.enduringepilepsy.com/archive/_2013 It's been helping my design and page load overall (Note: I do use Google Page Speed Service) But I cannot figure out how to be able to use this customizable masonry for my tag/category pages since they do no show the ability to edit on the Wordpress admin bar. I've looked at the php code in my files, and while I have become more familiar with php in the yr since I moved to Wordpress, am unsure how to edit these pages without making a mess. The plugin is http://codecanyon.net/item/essential-grid-wordpress-plugin/7563340 My theme, called Inzin, is no longer sold, and the developer disappeared from online. So I have lost all support. I would really appreciate any help anyone could offer. Thank you!
  6. I am learning so please excuse my lame questions! Here is what I have so far: Categories, of course and news in there. On the home page I have a box for every category with one main post, a picture and several more posts with titles only. I can make a view for every category with my basic skills but I need to do it the right way (or somehow the right way). It seems to me like some very complicated foreach statement but nothing has come to mind yet. Give me some starting point please. I would be very grateful for any directions, ideas or examples. Thank you! Featured post:http://oi59.tinypic.com/2i7sgwl.jpg Progress: I made it happen somehow Categories boxes:http://oi58.tinypic.com/epopiw.jpg Progress: Here is what I have for now: class Post extends Model { public $rows_posts; public $rows_featured_posts; public $_id; public function get_posts() { $this->_db->query("SELECT * from posts"); $this->rows_posts = $this->_db->resultset(); } public function get_ceatured_posts() { $this->_db->query("SELECT * from posts WHERE featured = 1 LIMIT 1"); $this->rows_featured_posts = $this->_db->resultset(); } } Child Class: class Featured_Publication extends Post { public $rows_featured_posts; public function create_featured_post() { $this->get_ceatured_posts(); foreach ($this->rows_featured_posts as $row_featured_post) { include_once VIEWS_PATH . 'homepage/featured_publication.php'; } } } I can do this for Featured posts, but I don't know how to show the contents from all categories in different boxes. I can only show the category title on the top of each box, but cannot put the posts in there. I suppose this below is wrong because it is not working at all. A class Category: class Category extends Model { public $_rows; public $_id; public function build_category() { $this->_db->query("SELECT * from categories"); $this->_rows = $this->_db->resultset(); } public function category_items() { $this->_db->query("SELECT * from posts WHERE category_id = '{$this->_id}'"); $this->_rows = $this->_db->resultset(); } } Child Class: class Category_Boxes extends Category { public $_rows; public $rows_posts_in_category; public $category_id; public function get_posts_from_category() { $this->build_category(); $this->_db->query("SELECT * from posts WHERE category_id = '{$this->category_id['category_id']}'"); $this->rows_posts_in_category = $this->_db->resultset(); } public function build_category_box() { $this->build_category(); $this->get_posts_from_category(); foreach ($this->_rows as $row) { include VIEWS_PATH . 'homepage/category_box.php'; // Here is my view for the category box } } }
  7. Hai guys, I'm busy with a category display script, but do I replace the text for an URL? Example: I've this code at the moment: <?php $query="SELECT `cat` FROM `video` WHERE `id`='".$_GET['video']."'"; $sql=mysql_query($query) or die(mysql_error()); while($line=mysql_fetch_array($sql)) { echo ''.$line['cat'].''; } ?> The output for example is: Category1,Category2,Category3. So, what do I need to let the output be like this: <a href="category.php?cat=Category1">Category1</a>, <a href="category.php?cat=Category2">Category2</a>, <a href="category.php?cat=Category3">Category3</a> Thanks for any help!
  8. Hi there, I am busy to create an e-commerce site where I need to import products from product feeds (in XML/CSV). I import the data to mysql and display those on my website. However, I am stuck where I need to match their categories with my site's categories. For example, I have category laptops which is under computer, but the data has no category laptops, instead they put most laptops under category notebooks. Or sometimes the feeds give you a laptop bags under category laptop. How could I possibly grab the right products under categories in the productfeed and put those into the right categories in my site? What could be the best logic to accomplish this? I have tried making keywords, however, I can't get it really neat. Could someone give me an advice here? Thank you
  9. Hello,I am new to here and apologise if this is posted in the wrong section, I would like to set the order that categories load within this script, basically i would like to load category ID 14 then 4 then 13. I have pasted my code below, if anyone can assist I would greatly appreciate it as I am pretty useless with PHP modifications! The output is a box within a wordpress site see attached image: http://ajswebsites.c...t.jpg ignore the bit at the bottom about the read morenot working that was something else that has been fixed! Thanks in advance. Let me know how I buy whoever a beer <?php function tie_home_tabs(){ $home_tabs_active = tie_get_option('home_tabs_box'); $home_tabs = tie_get_option('home_tabs'); $Posts = 5; if( $home_tabs_active && $home_tabs ): ?> <div id="cats-tabs-box" class="cat-box-content clear cat-box"> <div class="cat-tabs-header"> <ul> <?php foreach ($home_tabs as $cat ) { ?> <li><a href="#catab<?php echo $cat; ?>"><?php echo get_the_category_by_ID($cat) ?></a></li> <?php } ?> </ul> </div> <?php foreach ($home_tabs as $cat ) { $count = 0; $cat_query = new WP_Query('cat='.$cat.'&posts_per_page='.$Posts); ?> <div id="catab<?php echo $cat; ?>" class="cat-tabs-wrap"> <?php if($cat_query->have_posts()): ?> <ul> <?php while ( $cat_query->have_posts() ) : $cat_query->the_post(); $count ++ ;?> <?php if($count == 1) : ?> <li class="first-news"> <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?> <div class="post-thumbnail"> <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"> <?php tie_thumb('',272,125); ?> <span class="overlay-icon"></span> </a> </div><!-- post-thumbnail /--> <?php endif; ?> <h2><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> <p class="post-meta"> <?php tie_get_score(); ?> <?php the_time(get_option('date_format')); ?> <?php comments_popup_link( __( 'Leave a comment', 'tie' ), __( '1 Comment', 'tie' ), __( '% Comments', 'tie' ) ); ?> </p> <div class="entry"> <?php tie_excerpt_home() ?> <a class="more-link" href="<?php the_permalink() ?>"><?php _e( 'Read More ยป', 'tie' ) ?></a> </div> </li><!-- .first-news --> <?php else: ?> <li> <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?> <div class="post-thumbnail"> <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php tie_thumb('',60,50); ?></a> </div><!-- post-thumbnail /--> <?php endif; ?> <h3><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h3> <p class="post-meta"> <?php the_time(get_option('date_format')); ?> <?php comments_popup_link( __( 'Leave a comment', 'tie' ), __( '1 Comment', 'tie' ), __( '% Comments', 'tie' ) ); ?> <?php tie_get_score(); ?> </p> </li> <?php endif; ?> <?php endwhile;?> </ul> <div class="clear"></div> <?php endif; ?> </div> <?php } ?> </div><!-- #cats-tabs-box /--> <?php endif; } ?>
×
×
  • 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.