Image won't "delete"

General web design discussion, including HTML, CSS, and JavaScript

Image won't "delete"

Postby bizmaven » Wed Apr 20, 2011 7:45 pm

On this page http://phcb.org/tuition.shtml, the checkmark won't delete. Is this because the checkmark is in the ME code? How can I make it so that it actually deletes and goes away?

Is there a tips & tricks for this generically? i.e. Image area only shows up live if there is an image? else only in admin in case the user wants to add one?
bizmaven
 
Posts: 9
Joined: Wed Apr 13, 2011 6:26 pm

Re: Image won't "delete"

Postby justin » Thu Apr 21, 2011 5:06 pm

As with the other MagicEdit tags, if you delete an image it will default back to the original placeholder image. On the phcb.org site, it looks like you are using a total of three images: a checkmark, a transparent png, and a black square. In the left column, the default image is the transparent png. In the right column, it is the checkmark. If you add a checkmark in the left column and later delete it, it will revert back to a transparent png and disappear. In the right column, deleting the checkmark causes it to revert back to... the checkmark! That is why you are unable to delete them (and have uploaded black squares in their place).

Yes, there is a better way to do this. You can put what is called a cl_visible on the image and add a hidden field next to each checkmark td. In both columns, make the checkmark the default image. You can then make it so that the image only appears if the hidden field has been edited. In practice, the content manager could log in and place an 'x' in any of the hidden fields where the checkmark should show up; when he/she logs out of the site, the 'x' in the hidden field is no longer visible et voila, the checkmark shows up. To get rid of the checkmark, simply log in and delete the contents of the hidden field. The code might look something like this:
Code: Select all
<td>
   <img src="images/checkmark.png" cl_visible="=$checked" />
   <div cl_visible="=CLManager.activeSession.account:isAdmin">
      <p>Checked?<br />
      <magicedit me_name="checked" me_plain>No</magicedit></p>
   </div>
</td>

For more information, check out "Showing and Hiding Stuff" in the Advanced Magic section of our Resources page.
justin
 
Posts: 10
Joined: Tue Apr 12, 2011 2:53 pm


Return to Web Design

Who is online

Users browsing this forum: No registered users and 2 guests

cron