chrometweaks.org

If iPage is a website to create websites, then how did that website get created?

Click Here To View All Answers...


First of all If iPage is a website to create websites, then how did that website get created? Thanks in advance for any response. Another quick question... Ive integrated a column in the middle of the page to show categories and I get this error every now and again.

Warning: Invalid argument supplied for foreach() in /home/domecomp/public_html/shop/includes/modules/main_categories.php on line 52.

Any advice would be appreciated...

Comments (138)

Good question... I dunno what is the answer. I'll do some poking around and get back to you if I got an decent answer. You should email the people at iPage as they probably could give you help..

Comment #1

This starts at line 41 -68.

// 1.4 SHOW_COUNTS is 'true' or 'false', not true or false.

If (SHOW_COUNTS == 'true') {.

$products_in_category = tep_count_products_in_category($cid);.

If ($products_in_category > 0) {.

$categories_string .= ' ('$products_in_category')';.

}.

}.

$categories_string .= '';.

}.

// Traverse category tree.

Foreach ($foo as $key => $value) {.

If ($foo[$key]['parent'] == $cid) {.

// print "$key, $level, $cid, $cpath<br>";.

Preorder($key, $level+1, $foo, ($level != 0 ? $cpath$cid'_' : '')).

;.

}.

}.

}.

?>.

<! main_categories //>.

<tr>.

<td>.

<?php.

//////////.

// Display box heading.

//////////.

Thank you in advance..

Comment #2

That error generally means that $foo is not an array or is empty. you could do a check like if(is_array($foo))......

Comment #3

Indeed. Look a little bit above those lines for where $foo is defined (usually the result of a query) and verify the query is returning a result...

Comment #4

Im quite a newbie, could you please give me some code that would replace or sort this problem out..

Regards.

PR..

Comment #5

What is $foo exactly??.

Are you sure this array has been previously created?.

Put this right before de.

Foreach().

And tell us what you get:.

Echo "<pre>";.

Print_r ($foo);.

Echo "</pre>";.

Exit();.

Bye!..

Comment #6

Match the following (minus the second line) to what you have and replace it..

// Traverse category tree.

   if (is_array($foo)) {.

     foreach ($foo as $key => $value) {.

       if ($foo[$key]['parent'] == $cid) {.

         preorder($key, $level+1, $foo, ($level != 0 ? $cpath$cid'_' : ''));.

       }.

     }.

   }.

 }.

?>.

And that should fix you up...

Comment #7

Your a genius daemon!!!.

That seems to have worked............

Now for my next query...............................

Have you any experience with RMA????.

Thanks.

PR..

Comment #8

Thank you for the compliment but unfortunately I do not deserve it. It was a simple item that will become very common to you as you code more..

I am not familiar with RMA but I will give it a try...

Comment #9

Daemon!.

Just thought I'd add another thanks here so you know your solution has helped me out also!.

Thanks mate....

Tony..

Comment #10

I'll second that, Daemon! I should have looked here first. I thought I screwed it up with my url encoding tweak. Most appreciated!..

Comment #11

Hey proy, how did you get main_categories to display in the body of your page? I've been trying to insert the include somewhere in the body, and it only wants to appear in the heading or the footer section. I'm trying to use it as a navigation tool instead of the ususal box on the side of the page..

Any clue would be appreciated!.

JC..

Comment #12

I've found my problem.....

OPERATOR HEAD SPACE!!!! :oops: :roll:..

Comment #13

Ive integrated a column in the middle of the page to show categories and I get this error every now and again.

Warning: Invalid argument supplied for foreach() in /home/domecomp/public_html/shop/includes/modules/main_categories.php on line 52.

Any advice would be appreciated...

Comment #14

Could you give us the code along with the 6 lines preceeding and following line 52?..

Comment #15


This question was taken from a support group/message board and re-posted here so others can learn from it.