Jquery Popup Slider using lightbox plugin
Most of the developers need sliders for their website; in previous article we created Carousel slider using codeigniter, now we will create jquery popup slider using codeigniter.
If you are looking web hosting to host your codeigniter website, Sign Up for dreamhost web hosting services, which offers best services. There is special promo code for eknowledgetree readers please click below link to avail offer.
Now let’s create a controller function to fetch images from database in codeigniter to display slider.
In above functionality, we are passing two parameters $userid and $autoid , If we logged in to the application we need to pass userid and autoid to the function to fetch user details and uploaded images to the slider. Here usercardisplayinfo.php is view which we are showing user details , which is loaded into userinner template, here we are adding image slider to userinner template directly. If you don’t need user details with slider, you can directly create a view under codeigniter view folder and place below code there and call the view in the place of usedcardesplyinfo.php.
Now let’s create image slider view in userinner template.
In the above code I am adding if condition to check weather images are available or not. If no images are uploaded it will display default image in the view, removes hyperlink to image to restrict popup.
In else condition we will split the image using explode(), why we use explode()? In database while saving image names to table we separated with ~ symbol, while displaying images we need to remove those special symbols and store in $splittedstring.
Now count the no of images using php count() function, and store into $countimgs, now pass $splittedstring variable into array_keys() function to Return all the keys or a subset of the keys of an array, now display image using image tag.
If you are looking for wordpress themes to develop wordpress blog or website you can go for premium wordpress themes and Social share plugins for promotion, Here Studiopress offers lots of themes for you, while purchasing theme add Genesis framework to your theme which will help full in easy customization in design and single button to upgrade your wordpress versions.
Thanks for reading this article.