Jump to content

Recommended Posts

  • 4 weeks later...

Yeah, easiest thing to use is jQuery along side php with GET['msg']; variables.

 

That way you can use PHP to get what popup you want, and then use jQuery and a little CSS to make them appear =]

 

Example:

 

<div class="disable"></div>
<? if(isset($_GET['msg'])) { ?>
<div class="popup" id="msg">
<div class="cross">x</div>
<? // eventualy make it so it collects the items from the database so it can be updated without having to update the page ?>
<h3>System message</h3>
    <?
    switch($_GET['msg']) {
	case 0:
	// Automatic email to be send to admin and shown that it has been noted and that the error should go away within a few hours.
	echo "An unexpected error occoured.  Please notify the administrator.";
	break;
	case 1:
	echo "Your file was uploaded sucsessfully.";
	break;
	case 2:
	echo "An error occoured when the server was uploading your file.  Please check the file and try again.";
	break;
	case 3:
	echo "Your file is not a valid CSV.  Please check the file and try again.";
	break;
}
?>
    <div class="clear"></div>
    <? //rather than save, create confirm button which confirms all the data and then add into the database ?>
</div>
<? } ?>

 

 

Also, here's a little CSS you can use (style.css - or wherever):

 

.popup h3 {
margin-top:0;
}
.button {
color:#fff;
padding:0 10px;
width:auto !important;
height:27px !important;
border:1px #e9e9eb solid !important;
background:url(../images/l_bg.jpg) repeat-x;
}
.cross {
right:0;
cursor:pointer;
margin-right:30px;
position:absolute;
padding:0 4px 1px 4px;
border:1px #999 solid;
}
.disable {
z-index:3;
width:100%;
height:100%;
display:none;
position:fixed;
background:url(../images/disable.png) repeat;
}

 

 

And the jQuery if you need it (js/msg.js):

 

$(document).ready(function(){
$(".disable").fadeIn("slow");
$("#msg").fadeIn("slow");
});

 

 

And to save some loading time, use this to add in the jQuery so you're only loading it when it's needed:

 

<? if(isset($_GET['msg'])) { ?><script type="text/javascript" src="js/msg.js"></script><? } ?>

 

 

PHP is a server side language, Java or Jquery would be would best.

 

Another alternative is Lightbox, Fancybox, Darkbox, etc. You can download Lightbox here http://www.huddletogether.com/projects/lightbox2/[/i]]http://www.huddletogether.com/projects/lightbox2/. Very easy to implement. I prefer Fancybox for its use of inline frames within the java window, but it all depends on what you want to accomplish.

 

dangerousprince, great script! I can use that for myself in the new site im building. Props for the custom CSS :D

 

Also, try looking into ajax. You might be able to load your content through a div when you click on a link. You can set a drop shadow of like 20, block, 80% alpha and then dynamically load your "pop up". Just a thought if you arent comfortable with java.

PHP is a server side language, Java or Jquery would be would best.

 

You mean JavaScript.

 

Java is an object oriented language which runs on a virtual machine.  It was created by Sun Microsystems.

JavaScript is a scripting language which runs in a browser.  It was created by Netscape.

 

Aside from the name, which was Netscape merely trying to jump on board the hype Java was getting at the time, the two languages have nothing to do with one another.

Meant Java as in Java'script'. Coder shorthand, so to speak :P but a good note to point out the difference for all beginners.

 

Java'script' is what I meant, and using dangerousprince's code you should be able to create what you're looking for. You can tweak the css easily, if needed.

 

Also, look into using jquery. You can do a lot of what youre talking about with some codes they give on the site with some instruction.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.