+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: PHP Help

  1. #1
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    PHP Help

    i am writing a script that will make someone able to easily created an html format resume; so i have blocks that represent different parts of a resume and you just piece it together. i'm making a block to create a one or two column list (depending on the length) of items. for some reason, its not working.

    here's the code:
    PHP Code:
    // sets two column list for resume
    function resumeList($items){
    $minItems 4;            # any list containing this many or less items will be one column
    if ( count($items) <= $minItems ){
    $code '<div class="itemlist">';
    for (
    $i 1$i <= count($items)-1$i++){
    $code $code.'<p>'.$items[$i].'</p>'."\n";
    }
    $code $code.'</div>';
    }
    else{
    $numItemsHalf count($items) / 2;
    $code1 '<div class="itemlist">';
    for (
    $i 1$i <= $numItemsHalf-1$i++){
    $code1 $code1.'<p>'.$items[$i].'</p>'."\n";
    }
    $code1 $code1.'</div>';
    }
    $code2 '<div class="itemlist">';
    for (
    $i $numItemsHalf$i <= count($items)-1$i++){
    $code2 $code2.'<p>'.$items[$i].'</p>'."\n";
    }
    $code2 $code2.'</div>';
    }
    $code $code1."\n".$code2;
    }
    return 
    $code;

    please help.

  2. #2
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: PHP Help

    try
    PHP Code:
    <?php

    // sets two column list for resume
    function resumeList($items)
    {
        
    $minItems 4;            # any list containing this many or less items will be one column
        
    if (count($items)<=$minItems)
        {
            
    $code '<div class="itemlist">';
            for (
    $i=1;$i<count($items);$i++)
            {
                
    $code $code.'<p>'.$items[$i].'</p>'."\n";
            }
            
    $code $code.'</div>';
        }
        else
        {
            
    $numItemsHalf count($items) / 2;
            
    $code1 '<div class="itemlist">';
            for (
    $i 1;$i<$numItemsHalf;$i++)
            {
                
    $code1 $code1.'<p>'.$items[$i].'</p>'."\n";
            }
            
    $code1 $code1.'</div>';
        }
        
    $code2 '<div class="itemlist">';
        for (
    $i=$numItemsHalf;$i<count($items);$i++)
        {
            
    $code2 $code2.'<p>'.$items[$i].'</p>'."\n";
        }
        
    $code2 $code2.'</div>';

        
    $code $code1."\n".$code2;
        return 
    $code;

    }

    ?>
    couple things that were wrong. 1, you had two extra closing brackets, and your for() syntax was incorrect. you're supposed to use ; instead of , ;)

  3. #3
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: PHP Help

    thank you very much.

  4. #4
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: PHP Help

    no problem. if you're using notepad, try using something that checks your syntax and highlights the code for you. makes finding errors much easier ;)

    i personally use zend studio 5.5, but eclipse or aptana works just as fine

  5. #5
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: PHP Help

    i'm using SciTE. ok, now i have another problem. maybe the problem is just that i've been staring at a computer screen all day and can barely think. whats wrong with this code (other than the fact that its a jumbled mess):

    PHP Code:
    // sets resume code
    $resumeCode '<div id="resume">'.category('Education').resumeEdu('Clark College','Vancouver, Wa','Associates in Applied Technology','To Be Completed: June 2009'.category('Major College Courses').resumeList(array('Intro To Programming','Intro To Unix','Calculus I')).category('Skills').resumeList(array('Microsoft Office 2003/2007','XHTML 1.0, CSS','PHP','Python','Logical Problem Solving','Studied Basic Quantum Computing','Windows XP / Vista / DOS (also 95 and 98)','Debian Linux (can use VI)','Unix Shell Scripting','Higher Level Mathematics','Website Administration','Currently Studying Perl')).category('Experience').resumeExp('Webmaster','','','Designed and coded personal portfolio site. Used XHTML, CSS, and PHP. Site validated for XHTML Transitional 1.0 and CSS Level 2.1.').'</div>'
    again, thank you.

  6. #6
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: PHP Help

    you are missing the closing bracket on resumeEdu( ;)

    PHP Code:
    <?php

    // sets resume code
    $resumeCode '<div id="resume">'.

    category('Education').
    resumeEdu('Clark College',
        
    'Vancouver, Wa',
        
    'Associates in Applied Technology',
        
    'To Be Completed: June 2009'
    ).

    category('Major College Courses').
    resumeList(
        array(
    'Intro To Programming',
            
    'Intro To Unix',
            
    'Calculus I')
        ).
        
    category('Skills').
    resumeList(
        array(
    'Microsoft Office 2003/2007',
            
    'XHTML 1.0, CSS',
            
    'PHP',
            
    'Python',
            
    'Logical Problem Solving',
            
    'Studied Basic Quantum Computing',
            
    'Windows XP / Vista / DOS (also 95 and 98)',
            
    'Debian Linux (can use VI)',
            
    'Unix Shell Scripting',
            
    'Higher Level Mathematics',
            
    'Website Administration',
            
    'Currently Studying Perl'
        
    )
    ).

    category('Experience').
    resumeExp('Webmaster',
        
    '',
        
    '',
        
    'Designed and coded personal portfolio site. Used XHTML, CSS, and PHP. Site validated for XHTML Transitional 1.0 and CSS Level 2.1.'
    ).
    '</div>';

    ?>
    Last edited by xPlozion; 02-02-2009 at 09:44 PM.

  7. #7
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: PHP Help

    thank you again.
    i would give you rep, but you are already the last person i gave rep to, so it won't let me.

  8. #8
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: PHP Help

    :'( just dont' forget once you rep someone else ;)

    time for bed :wavey::sleep:
    Last edited by xPlozion; 02-02-2009 at 09:49 PM.

  9. #9
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: PHP Help

    wait... its still not working.
    please help... again. :happysad:

  10. #10
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: PHP Help

    check the code that that's being parsed into (if it's not on here already). if it doesn't get solved by tomorrow, i'll take a look at it then

    i've gotta get some sleep

    night
    Last edited by xPlozion; 02-02-2009 at 09:51 PM.

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Ever Been Suspended For Using PHP?
    By dragoneye_xp in forum Off Topic
    Replies: 26
    Last Post: 08-16-2009, 07:17 PM
  2. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  3. currently have an application pending php
    By biomasti in forum Free Hosting
    Replies: 1
    Last Post: 09-03-2008, 01:58 PM
  4. php errors galore
    By DMG Online in forum Scripts & 3rd Party Apps
    Replies: 9
    Last Post: 05-17-2008, 06:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers