• Programming RSS Feed

    by Published on 03-24-2010 02:36 PM

    aaaThe other day whilst coding the online user map for this site I needed to use a foreach loop within one of the vBulletin templates to access data within an array, In earlier versions of vBulletin this wasn't possible as the foreach didn't exist.

    There seems to be a distinct lack of documentation on what is and isn't supported in the latest 4.0.x version of vBulletin and I didn't even know the following existed until a vBulletin support member explained it to me, I thought I'd make it easier for anyone else programming in vBulletin and write a quick tutorial on how to use it.

    HTML Code:
    <vb:each from="array" key="key" value="value"></vb:each>
    You could use the above to browse through and get information from an array such as this below:

    PHP Code:
     
    ...
    by Published on 03-16-2010 02:43 AM
    1. Categories:
    2. Javascript

    This article will introduce you to Javascript and help you get started with using Javascript to write messages to the documents.

    Javascript is a scripting language that can be used to apply more interactive code to your website, it also makes accessing objects within a page much simpler.

    Javascript can either be placed in a file with a .js extension or placed within html using the script tags.

    HTML Code:
    <script type="text/javascript">
    document.write("My first piece of
    ...
    by Published on 03-05-2010 10:11 PM
    1. Categories:
    2. Html,
    3. Css

    So far throughout our XHTML tutorials we have learnt the basics of how to structure our XHTML files. This article will introduce CSS so that you can start applying designs to your websites.

    We will use the code from the XHTML div example and expand upon it adding the CSS code.

    If you have no prior knowledge of CSS then you may wish to consult the CSS tutorials section and then come back to this guide for implementing XHTML and CSS.

    There are various ways to apply CSS to your XHTML, a simple way is to add the code directly to the tags with the style attribute, this is useful when drafting work but can make your code look extremely messy when you start to add more complicated code. Keeping all of the CSS in one place allows us to see it more clearly and know which part needs editing in the future to make changes easy.

    The method we shall be using will be applying the CSS straight to the tag names, if we have two of the same tags but only wish to apply the CSS to one of those tags then we can add an id attribute to the tag as such:

    HTML Code:
    <div id="header"></div>
    ...
    by Published on 02-27-2010 01:47 PM
    1. Categories:
    2. Php

    When you are writing programs you will find that sometimes you need to perform code only if something has happened, in the previous form post article we used an if statement to get the information from the form only if a used had submitted the form, this stopped the script from trying to get blank form information.

    This shows how we can use conditional statements within scripts to specify when certain code should be run depending on the outcome of a condition that we set.

    The main conditional statements in php are:
    • If
    • Else
    • Switch


    The if Statement can be used in the following format:

    PHP Code:
    <?php
    if (condition)
    {
         
    // If condition is true Perform this code
    }
    else
    {
         
    // Else perform this code
    }
    ?>
    The above example shows how the if statements works, if the condition inside the brackets is met then the code is run with the {} brackets, if that condition is not met then the code in {} brackets after the else is run.

    Sometimes we need to use multiple if statements because there is more than one condition, for this we can combine if and else to use the elseif statement, this works in the following: ...
    by Published on 02-26-2010 09:05 PM
    1. Categories:
    2. Php

    Todays article will guide you through the process of how we can use php to get information from forms when they are submitted. To do this in php we use the post function, this means when a form is submitted with the post method then values are stored and available for use.

    These values are hidden from anyone else which is good for security as opposed to the php get function. There are also no limits on the amount of data that can be stored at once with post so it is more useful for longer user inputs such as comments in text boxes foe example.

    The only limit imposed with the post function is an 8mb maximum size for the data, this is set by default in php.ini and can be changed if needed when uploading larger amounts of data or files.

    Let's create a file called testPost.php to test this new method of getting information from forms:

    HTML Code:
    <form action="testPost.php" method="post">
    Test Field - <input type="text" name ="testField" />
    <input type="submit" value="submit" />
    </form>
    This is ...
    by Published on 02-20-2010 06:40 PM
    1. Categories:
    2. Php

    The next step to learning php is beginning to pass content into your page, this can be done via variables set within the url. The values of these variables are also present within the url.

    To set a variable and it's value in a url you would do the following:

    Code:
    http://www.domain.com/test.php?variable=content&variable2=content2
    The ...
    by Published on 02-08-2010 10:56 PM
    1. Categories:
    2. Php

    This tutorial will teach you how to store information as variables and then use these throughout the page to generate content. In php variables are shown by a dollar sign followed by the name of the variable. So if you wished to have a variable named default then it would be written as $default.

    Variables are one of the keys to learning how to create dynamic websites, let's see how we can generate page content by simply creating a few variables.

    From the first php tutorial you should know how to implement php code and how to show basic messages on screen to the user, above described how a variable is shown.

    Here is an example of how we can set our first variable in php:

    PHP Code:
    <?php

    $testVariable 
    'Here is my first variable';

    ?>
    The above sets the sentance ...

  • Stay Updated