Jump to content

Search the Community

Showing results for tags 'divs'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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 (PhpStorm, VS Code, 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


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 2 results

  1. Here's a line. I want to add 100 more of same lines and increment the page numbers as shown below. I know I can just manually add 100 lines but Is there a way to do this with PHP that would make it easy? Or is this more of a javascript thing? // original $page1 = '<a href="?type='. $type_id .'&name='. $get_type_3_name_slug .'&page=1">1</a>'; // new $page1 = '<a href="?type='. $type_id .'&name='. $get_type_3_name_slug .'&page=1">1</a>'; $page2 = '<a href="?type='. $type_id .'&name='. $get_type_3_name_slug .'&page=2">2</a>'; $page3 = '<a href="?type='. $type_id .'&name='. $get_type_3_name_slug .'&page=3">3</a>'; $page4 = '<a href="?type='. $type_id .'&name='. $get_type_3_name_slug .'&page=4">4</a>'; $page5 = '<a href="?type='. $type_id .'&name='. $get_type_3_name_slug .'&page=5">5</a>'; ...etc
  2. Hi, I'm not at all savvy with PHP, but I am trying to learn and I would really appreciate some help. Please excuse my limited knowledge and try not to get too annoyed. Here is what I'm looking to achieve: So lets I want my PHP to grab these files and place them on my page 2009-1.jpg 2009-2.jpg 2009-3.jpg 2010-1.jpg 2010-2.jpg 2010-3.jpg 2010-4.jpg 2011-1.jpg 2011-2.jpg 2011-3.jpg Instead of just having all of them appear in one div as they are now (see code below) <?php if($dirHandler = opendir($images_dir)){ while(false !== ($file = readdir($dirHandler))){ $files[] = $file; } } natcasesort($files); foreach($files as $myFile){ $name = explode(".", $myFile); if($myFile != "." && $myFile != ".." && ($name[1] == "jpg" || $name[1] == "JPG" || $name[1] == "jpeg" || $name[1] == "JPEG")){ echo "<div class='thumb'><a href='" . $images_dir . "/" . $myFile . "'><img src='" . $images_dir."/thumb/" . $myFile . "'></a></div>\n"; } } ?> I need divs to be "generated". (To put it very dumbly: If filename contains "2011" then create div class=2012_div and fill with "2011" ".jpg") So from the files above. we would end up with: <div class="2009_div"> <div class='thumb'><a href='_Images/Dates/Jue 25/2009-1.jpg'><img src='_Images/Dates/Jue 25/thumb/2009-1.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2009-2.jpg'><img src='_Images/Dates/Jue 25/thumb/2009-2.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2009-3.jpg'><img src='_Images/Dates/Jue 25/thumb/2009-3.jpg'></a></div> </div> <div class="2010_div"> <div class='thumb'><a href='_Images/Dates/Jue 25/2010-1.jpg'><img src='_Images/Dates/Jue 25/thumb/2010-1.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2010-2.jpg'><img src='_Images/Dates/Jue 25/thumb/2010-2.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2010-3.jpg'><img src='_Images/Dates/Jue 25/thumb/2010-3.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2010-4.jpg'><img src='_Images/Dates/Jue 25/thumb/2010-4.jpg'></a></div> </div> <div class="2010_div"> <div class='thumb'><a href='_Images/Dates/Jue 25/2011-1.jpg'><img src='_Images/Dates/Jue 25/thumb/2011-1.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2011-2.jpg'><img src='_Images/Dates/Jue 25/thumb/2011-2.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2011-3.jpg'><img src='_Images/Dates/Jue 25/thumb/2011-3.jpg'></a></div> </div> Is this possible? Again, any help much appreciated. Thanks!
  • 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.