Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9003303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:41:41+00:00 2026-06-16T00:41:41+00:00

Hello everybody I’m new in the php world still learning, and I’m completely lost.

  • 0

Hello everybody I’m new in the php world still learning, and I’m completely lost. I’ve tried everything and read a lot of blogs but nothing helps me to figure out how to do it.
I have this code (below) which works perfectly.. it’s dividing a long list in blocks of 5 elements, thanks to <ul> & <li>‘s.

<?php
$values = range(1, 31);
$rows = array_chunk($values, 5);


foreach ($rows as $row) {
    print "<ul>";
    foreach ($row as $value) {
        print "<li>" . $value . "</li>";
    }
    print "</ul>";
}
?>

But When I try to merge it together with my other code (below), it stops to work. It only displays the <ul>‘s and no data is putted in <li>‘s which don’t even display.

<?php 
        $product = Mage::getModel('catalog/product');
        $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
        ->setEntityTypeFilter($product->getResource()->getTypeId())
        ->addFieldToFilter('attribute_code', 'manufacturer');
        $attribute = $attributes->getFirstItem()->setEntity($product->getResource());
        $manufacturers = $attribute->getSource()->getAllOptions(false);
?>


<ul> 
<?php foreach ($manufacturers as $manufacturer): ?>
    <li>
        <a href="/manufacturer/<?php echo $manufacturer['label'] ?>">
            <?php echo $manufacturer['label'] ?>
        </a>
    </li>
<?php endforeach; ?>
</ul>

This is one of the variants I’ve tried (the one that doesn’t show me a 500 error)

<?php
$rows = array_chunk($manufacturers, 5);


foreach ($manufacturers as $manufacturer) {
    echo "<ul>";
    foreach ($row as $manufacturer) {
        echo "<li>"  ?> 
                <a href="/manufacturer/<?php echo $manufacturer['label'] ?>"><?php echo $manufacturer['label'] ?></a>
<?php   echo "</li>"; ?>
<?php    }
    echo "</ul>";
}
?>

I know probably what I’m doing is completely wrong, but as I said I’m new still learning (I have a long way to go, I know.)

Any help will be more than appreciate. Thank you in advance!

EDITS:
Array ( [value] => 15 [label] => Jordan )
Array ( [value] => 19 [label] => Maison Scotch )
Array ( [value] => 5 [label] => Museum )
Array ( [value] => 17 [label] => Nike )
Array ( [value] => 16 [label] => Nike Basket )
Array ( [value] => 11 [label] => On Tour )
Array ( [value] => 7 [label] => PeB )
Array ( [value] => 14 [label] => Penfiled )
Array ( [value] => 4 [label] => President’s )
Array ( [value] => 23 [label] => Scotch & Soda )
Array ( [value] => 12 [label] => Solovair )
Array ( [value] => 13 [label] => Supra )
Array ( [value] => 20 [label] => Vans )
Array ( [value] => 18 [label] => Wood Wood )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:41:42+00:00Added an answer on June 16, 2026 at 12:41 am

    You mix your variables. Probably you want something like this:

    <?php
    $rows = array_chunk($manufacturers, 5);
    
    foreach ($rows as $row) {
    ?>
        <ul>
        <?php foreach ($row as $manufacturer) { ?>
            <li>
                <a href="/manufacturer/<?php echo $manufacturer['label']; ?>">
                    this is a link
                </a>
            </li>
        <?php } ?>
        </ul>
    <?php } ?>
    

    Note how the variables are cascaded in the two foreach loops.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My string contain a lot of HTML entities, like this &#x22;Hello&nbsp;&lt;everybody&gt;&nbsp;there&#x22; And I want
<?php $conn= new mysqli(localhost, my_user, my_password, world); //changed for the sake of this question
Hello everybody and thanks for taking the time to read this ; I was
Hello everybody, I have a small code in PHP that I would like to
Hello everybody I am drawing dynamic table and I want to add header for
Hello everybody my linq to sql selection does not working on dateTime field for
Hello everybody i have C++ tStringGrid I want to get string from specific cell
hello everybody i have a listbox within which is a datatemplate.Inside it is checkbox,textbox,label...Wat
Hello good fellas i'm sure everybody is cool.I'm about to start a tutorial about
Hello everybody! I have a SQL (see above) and i would like to know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.