It's probably OBVIOUS to most of you (I'm a self-taught PHP novice) but I can't, for the LIFE of me, figure out what's wrong with this code!

I'm getting a parse error that points to the open curly quotes (in red) in the first line of this code: "...parse error, unexpected '{' in /blah/blah/index.php on line [first line in code below]."

I think I must be blind... can anybody see what's wrong here?

<?php if (mosCountModules('user3') || (mosCountModules('user4') || (mosCountModules('user5')) { ?>
            <div id="pod"><!-- Start pod-->
				<?php if (mosCountModules('user3')) { ?>
                    <div id="podcol1" style="width:<?php echo $podmodwidth ?>;"><?php mosLoadModules ('user3',-2); ?></div><?php } ?>
				<?php if (mosCountModules('user4')) { ?>
                    <div id="podcol2" style="width:<?php echo $podmodwidth ?>;"><?php mosLoadModules ('user4',-2); ?></div><?php } ?>
                <?php if (mosCountModules('user5')) { ?>
                    <div id="podcol3" style="width:<?php echo $podmodwidth ?>;"><?php mosLoadModules ('user5',-2); ?></div><?php } ?>
            </div><!-- End pod-->
			<?php } ?>

Thanks for ANY help/suggestion!

Recommended Answers

All 5 Replies

I think it's sorted.....

if(mosCountModules('user3') || (mosCountModules('user4')) || (mosCountModules('user5')) ) { 
?>
            <div id="pod"><!-- Start pod-->
				<?php if (mosCountModules('user3')) { ?>
                    <div id="podcol1" style="width:<?php echo $podmodwidth ?>;"><?php mosLoadModules ('user3',-2); ?></div><?php } ?>
				<?php if (mosCountModules('user4')) { ?>
                    <div id="podcol2" style="width:<?php echo $podmodwidth ?>;"><?php mosLoadModules ('user4',-2); ?></div><?php } ?>
                <?php if (mosCountModules('user5')) { ?>
                    <div id="podcol3" style="width:<?php echo $podmodwidth ?>;"><?php mosLoadModules ('user5',-2); ?></div><?php } ?>
            </div><!-- End pod-->
			<?php } ?>

If this has helped you please add to my reputation.

thanks!

Regards,
Alex

putting html in between the php tags makes it very confusing to me.

here is some code I made see if it solved the problem:

<?php

if ((mosCountModules('user3')) || (mosCountModules('user4')) || (mosCountModules('user5'))) {
	echo '<div id="pod"><!-- Start Pod -->';
	if (mosCountModules('user3')) {
		echo '<div id="podcol1" style="width:' . $podmodwidth . '">' . mosLoadModules('user3',-2) . '</div>';
	}
	if (mosCountModules('user4')) {
		echo '<div id="podcol2" style="width:' . $podmodwidth . '">' . mosLoadModules('user4',-2) . '</div>';
	}
	if (mosCountModules('user5')) {
		echo '<div id="podcol3" style="width:' . $podmodwidth . '">' . mosLoadModules('user5',-2) . '</div>';
	}
	echo '</div><!- End pod -->';
}

?>

I find HTML between tags quite confusing aswell.

GEOHAM - have you set out your code as it is on here? You might want to space it out a little bit clearer and possibly comment the code so you know what it is if you ever have to come back to it in the future.

I think it's sorted.....

if(mosCountModules('user3') || (mosCountModules('user4')) || (mosCountModules('user5')) ) { 
?>
            <div id="pod"><!-- Start pod-->
				<?php if (mosCountModules('user3')) { ?>
                    <div id="podcol1" style="width:<?php echo $podmodwidth ?>;"><?php mosLoadModules ('user3',-2); ?></div><?php } ?>
				<?php if (mosCountModules('user4')) { ?>
                    <div id="podcol2" style="width:<?php echo $podmodwidth ?>;"><?php mosLoadModules ('user4',-2); ?></div><?php } ?>
                <?php if (mosCountModules('user5')) { ?>
                    <div id="podcol3" style="width:<?php echo $podmodwidth ?>;"><?php mosLoadModules ('user5',-2); ?></div><?php } ?>
            </div><!-- End pod-->
			<?php } ?>

AWESOME!!!! Thanks SO MUCH, Alex! :) Daniweb Rocks! (See eeaa.us for the results of your labors.)

To kkeith29: Thanks!... your code worked (I no longer got the parse error) but it broke my styling(?).

Instead of floating each "podcol," they were stacked... which negates the code (which is wholly there to control the column width based on how many modules are loaded (see eeaa.us). Thanks VERY much for your fix... I will take your suggestion to NOT nest PHP inside tags to heart!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.