dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Need a hint on managing images via CMS backend

Hybrid View

  1. #1
    Join Date
    Jan 2010
    Location
    Stalowa Wola
    Posts
    1

    Need a hint on managing images via CMS backend

    Hello,

    I'm developing a simple CMS and working on a backend now. I want each, lets say, article to have a slideshow editable through a backend site. I created a list of images loaded using PHP from a MySQL database - they are <img> objects in a single <div>. To each <img> belongs a small <div> containing 3 <a> objects formated as buttons: move up, move down, delete (the order of images does matter). This is how it looks like:

    HTML Code:
    <img src="pic.jpg" id="o1" alt="" style="display: block">
    <div class="photoMenu" id="pm1" style="display: block">
    <a class="pm_up" title="Move up" onClick="javascript:swap(1,'up')">&nbsp;</a>
    <a class="pm_down" title="Move down" onClick="javascript:swap(1,'down')">&nbsp;</a>
    <a class="pm_del" title="Delete" onClick="javascript:rid(1)">&nbsp;</a>
    </div>
    I thought it would be fun to be able to move the images up and down and delete them interactively, without having to reload the page each time, and afterwards click a submit buttom to apply the changes in the database. The problem is I'm not sure how to code it.

    I thought of two solutions. One would be: each time user clicks up or down, the image swaps it's "src" and "id" with the upper or lower neighbour. That would work fine if it weren't for the delete option. With an id missing, swapping fails.

    The other solution I though of was an array containing filenames ("src's") and a funtion that renders them. This is however difficult without using OOP.

    Are there somewhere any snippets doing what I want to do? Or maybe there is another solution, not necessarily using JS? Help of any kind will by very appreciated.

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by Cole85 View Post
    I thought it would be fun to be able to move the images up and down and delete them interactively, without having to reload the page each time, and afterwards click a submit buttom to apply the changes in the database. The problem is I'm not sure how to code it.
    AJAX?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles