background preloader

Csaw programming ressources

Facebook Twitter

AJAX Introduction. AJAXForms - Home. Code Snippets. Disabling Magic Quotes. DIV/SPAN. This can be used to create the coolest effects in a website. Thats the good news. The bad news is that each browser appears to have its unique way of handling these tags. So what appears to be an extremely cool effect in your favorite browser will appear to be something very similar to green goo on other browsers.

Using this a lot will give you sleepless nights - trust me - I know. I will try to provide the best way to use this technology. Div Tag Now that you are all sufficiently scared, lets try to write some text into the DIV tag. Hello World Now to change the text inside it. document.getElementById("div_tag").innerHTML = "Hell World"; Lets create some more effects. document.getElementById("div_tag").innerHTML = "<font color=\"#ff0f0a\">Goodbye</font>" + "<a href=\" I don't have to tell you what you can do armed with this knowledge and a little imagination. InnerHTML : A property of the DIV or SPAN. More methods/properties of this will come latter. Span. DOMDocument, whitespace, PHP | NetWebLogic.

The DOMDocument is a convenient way of manipulating an XML file. While this is for PHP, I’ve come across some great parsers for use on a business iphone using lib2xml but we leave that for another day. One issue I ran into was the fact that when loading an XML file, DOMDocument treats the tabs and spaces which make the XML readable as empty text nodes. This presents a problem when you try and traverse the DOM by using attributes like firstChild and nextChild. For example: Here is the XML file, “example.xml”: Ideally, to get the value within <tag> we would want to do this : The reason this happens is because the space between the <root> and <tag> tags is treated as a text node element, and so what you do is choose that text node first.

What happens here is you load the file first, trim whitespace between tags, and then load the string into the DOMDocument object. EasyFileBrowse - Create your own sortable folder index. You are seeing this very light version of the page, as you are using an outdated browser! is done in XHTML 1.0 and supports CSS 2.0, please upgrade your browser if you want a better version of this site. Thank you, please help us developers keep up with the industry rather than patching our code for outdated applications. EasyFileBrowse Advertisement: Category: PHP Version:1.0 Last page update:14.04.2003 »Download EasyFileBrowse.

Version History - 1.0 Initial release Short information EasyFileBrowse displays all the documents in one folder in a HTML table. Restrictions - Only for use, not for redistribution, please link to this site instead. - Don't change the code. Requirements Long information Sometimes you want to offer people files for browsing and downloading and you don't feel like using the simple listing your server generates automatically. This is where you can use EasyFileBrowse to offer the files in a folder for browsing and download. Installation Notes Usage Notes <! <! Enhance your input fields with simple CSS tricks. We're all trying to build an effective and good looking web forms. But there are always a new challenges. If you read my previous articles on how to build a better web forms, you could have noticed there are so many details.

Label positioning, context highlighting or justifying elements. But, with just a few simple CSS tricks you can make a usual, boring web forms more effective and exciting. See it live The example you are going to see is something that you use every day: blog comment form. …add some borders At least what you can do is to add borders and padding to your input fields. Let me review the code above shortly. Now, this was very simple. . … add some background You can also add some solid background like in the example below Or you can add a soft gradient as a background. The trick is simple and is contained in last three lines of the code.

But you can do even more! …add some behavior But very simple. As you can see, the code is very simple. It is now working in IE. Experiment. File Upload. A very useful aspect of PHP is its ability to manage file uploads to your server. Allowing users to upload a file to your server opens a whole can of worms, so please be careful when enabling file uploads. Before you can use PHP to manage your uploads, you must first build an HTML form that lets users select a file to upload. See our HTML Form lesson for a more in-depth look at forms. HTML Code: <form enctype="multipart/form-data" action="uploader.php" method="POST"><input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /><input type="submit" value="Upload File" /></form> Here is a brief description of the important parts of the above code: Save that form code into a file and call it upload.html.

Display: After the user clicks submit, the data will be posted to the server and the user will be redirected to uploader.php. The file is too large and you do not want to have it on your server. PHP Code: Filesystem. Glob. Since I feel this is rather vague and non-helpful, I thought I'd make a post detailing the mechanics of the glob regex. glob uses two special symbols that act like sort of a blend between a meta-character and a quantifier. These two characters are the * and ? The ? Matches 1 of any character except a / The * matches 0 or more of any character except a / If it helps, think of the * as the pcre equivalent of .* and ? Note: * and ? A.php // * matches nothing aa.php // * matches the second 'a' ab.php // * matches 'b' abc.php // * matches 'bc' b.php // * matches nothing, because the starting 'a' fails bc.php // * matches nothing, because the starting 'a' fails bcd.php // * matches nothing, because the starting 'a' fails It does not match just a.php and aa.php as a 'normal' regex would, because it matches 0 or more of any character, not the character/class/group before it.

Executing glob("a?. Glob's regex also supports character classes and negative character classes, using the syntax [] and [^]. › HTML5 & CSS3 Browser Capabilities. Here is a simple popup contact form (modal popup) A popup contact form has many benefits. You can add a button/link in every page that pops up the contact form in a modal popup. That makes the contact form easily accessible from any part of the website. Your web site visitors do not have to ‘hunt’ for the ‘contact us’ page. Download the popup contact form code You can download the contact form that best fits your needs and then customize as required. Features of the popup contact form Easy to customizeStandards compliant (100% XHTML 1.0 strict validated, uses CSS)Secured against spam bots and attacksAjax submission.Hosted on your own web serverFree!

Installing the contact form on your web site Unzip the downloaded contact form code.Edit contactform.php and edit the email address to your email address Customizing the form To change the style of the form, edit popup-contact.css. You can add any type of additional fields to the form. For client side validations, this script uses the JavaScript validation library.

License Be Sociable, Share! How to upload files to remote server with PHP cURL | web development tutorials. Html - Javascript to figure out which button was pressed. JavaScript DOM - Date. Load XML file into PHP from a link. Managing Sessions and State with PHP. By Brian Fioca 05/18/2006 MVC Frameworks, such as WASP, provide a solid jumping-off point for entry-level programmers to produce strong, well-formed code. The framework simplifies such things as creating a page (using a kind of page object) and creating or searching for data (using database table objects). However, probably the most difficult concept for novice PHP programmers to grasp is handling their application's state and session data. This article will address that issue by providing a simple strategy for state management using the WASP framework. WASP is an MVC framework written for PHP and based on concepts outlined in previous articles on this site.

Page State vs. To understand state and session management in an MVC framework, you must understand the difference between the two, and when to use one instead of the other. Session State A web application session is a single start-to-finish interaction between a user and the application. Page State Session State Example The line The lines. Paste Word Count. Pathinfo. Php - Select random file from directory. PHP :: PHP Sending Whitespace After Headers? Jan 7, 2011 Having a strange issue with the email class in codeigniter.

When I send email directly to my gmail account email address, it works fine. However if I send email to a different email address and use POP3 to import that email address into gmail, then for some reason all the headers are included in the message. Here's the code for sending the email: $this->email->clear();$config['mailtype'] = "html";$this->email->initialize($config);$this->email->set_newline("");$this->email->from('url', 'Website');$this->email->to('url');$this->email->message($message); Here's what arrives in my inbox when the email is sent to an account which is imported into gmail via POP3: Date: Fri, 7 Jan 2011 15:07:04 +0000 From: "Website" <url>Reply-To: "url" <url>X-Sender: url X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="B_ALT_4d272c1835c46" This is a multi-part message in MIME format.

--B_ALT_4d272c1835c46. PHP Example AJAX and XML. PHP XML Date Problem - PHP. Reading and writing the XML DOM with PHP. Reading and writing Extensible Markup Language (XML) in PHP may seem a little frightening. In fact, XML and all its related technologies can be intimidating. However, reading and writing XML in PHP doesn't have to be a daunting task. First, you need to learn a little about XML -- what it is and what it's used for. Then, you need to learn how to read and write XML in PHP, which you can do in many ways.

This article provides a short primer on XML, then explains how to read and write XML in PHP. What is XML? XML is a data storage format. <name>Jack Herrington</name> This <name> tag contains some text: Jack Herrington. An XML tag that contains no text looks like this: There may be more than one way to code something in XML. You can also add attributes to an XML tag. You can encode special characters in XML, too. An XML document that contains tags and attributes formatted like the examples provided is well formed, which means the tags are balanced, and the characters are encoded properly. <? <? <? Removing whitespace from a string? Str_replace. Strip some but not all whitespace - Upload file with php and save path to sql. Upload php check the file name duplicat - php.

XML2OWL demonstration platform.