• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Index.php

#1
views/cms/index.php



PHP Code:
<img src="<?php echo base_url('images/large_pic.jpg');?>" width="200px">&nbsp&nbsp<img src="<?php echo base_url();?>images/large_pic3.jpg" width="200px">&nbsp&nbsp<img src="<?php echo base_url();?>images/large_pic4.jpg" width="200px">&nbsp&nbsp<img src="<?php echo base_url();?>images/large_pic5.jpg" width="200px" height="165px">

     
            
<?php if(isset($images)) : ?>
                <?php foreach ($images as $image) : ?>
                    <?php 
                    
//do whatever you need with each image
                    echo "images";
                ?>
                <?php //endforeach; ?>
                
            <?php else : ?>
                    <?php
                    
// determine what to do if there are no images
                    echo "else images";
            ?>
            <?php endif; ?>
            


I am using Debugger and have several errors:



<img src="<?php echo base_url('images/large_pic.jpg');?>" width="200px">&nbsp&nbsp<img src="<?php echo base_url();?>images/large_pic3.jpg" width="200px">&nbsp&nbsp<img src="<?php echo base_url();?>images/large_pic4.jpg" width="200px">&nbsp&nbsp<img src="<?php echo base_url();?>images/large_pic5.jpg" width="200px" height="165px">

// undefined image file :  <?php echo base_url('images/large_pic5.jpg');?>
// undefined image file :  <?php echo base_url('images/large_pic3.jpg');?>
// undefined image file :  <?php echo base_url('images/large_pic.jpg');?>
// undefined image file :  <?php echo base_url('images/large_pic4.jpg');?>

<?php else : ?>   // syntax error unexpected else

<?php endif; ?>  // syntax error unexpected endif


Can anyone help me to fix the error next to // sign.

Thanks in advance.
" If I looks more intelligence please increase my reputation."
Reply

#2
Look at your top image code the second image and you should see your error on the base_url().
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
You broke up the structure by commenting the endforeach.
Remove the // in front of endforeach;
Check if you keep getting errors after that.

Next, start each image block on a new line in your php file.
It's much easier to read, and it has no effect on the way your browser handles the code. The browser will only start a new line if you deliberately insert a <br />.

Also close the <image> tag with /> at the end, with a space and a / before the >
All html-tags that don't come in pairs, like <hr />, <br />, <img /> etc. should be closed the way I show you here.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.