Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 01-16-2010, 12:41 PM unexpected T_ELSEIF
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
I'm having trouble with this script I'm coding in Wordpress, the error goes away if I change the elseif statements to if statements!

Does anyone know how I can fix it whilst keeping the statements as 'elseif' ?

PHP Code:
<?php
// include page-specific scripts first
// just echo content if nothing specific
?>

<?php
// about
if(is_page('2')) {
?>
    <div class="section no-margin">
    <div id="tweet">
        <div id="stats">
            <p>Name: <span class="highlight">Matt Pealing</span><br />
                Born: <span class="highlight">31/03/1986</span><br />
                Location: <span class="highlight">Ellesmere Port, North West UK</span><br />
                Occupation: <span class="highlight">Freelance Designer / Developer</span></p>
        </div>
        <div>
        <p>        
<?php twitter_messages('pealo86'); ?>
    </p>
    <p><a href="http://www.twitter.com/pealo86"><img src="http://twitter-badges.s3.amazonaws.com/follow_me-b.png" alt="Follow pealo86 on Twitter"/></a>
    </p>
    </div>
    </div>
    </div>
<?php the_content(); } ?>

<?php
// cool stuff
elseif(is_page('16')) {
?>
<img src="<?php bloginfo('template_url'); ?>/image/content-cool-stuff.gif" />
<?php the_content(); } ?>

<?php
// contact
elseif (is_page('18')) {
    
the_content();
    include (
TEMPLATEPATH '/include/contact/result.php');
    include (
TEMPLATEPATH '/include/contact/process.php');
    include (
TEMPLATEPATH '/include/contact/frm-contact.php');
} else {
    
the_content();
}

?>
Thanks.
__________________

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
 
Register now for full access!
Old 01-16-2010, 01:06 PM Re: unexpected T_ELSEIF
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
And which line shows the error?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-16-2010, 01:10 PM Re: unexpected T_ELSEIF
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
Ah yeah forgot about that bit!

It's this line:
Quote:
// cool stuff
elseif(is_page('16')) {
__________________

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Old 01-16-2010, 02:25 PM Re: unexpected T_ELSEIF
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I cannot see by the eye why, but something is confusing the PHP engine.
I just reformatted a bit your code by replacing the "end php code" / "begin php code" to have everything in 1 lock, and no more problems.
PHP Code:
<?php
// include page-specific scripts first
// just echo content if nothing specific

// about
if(is_page('2')) {
    echo <<<html
    <div class="section no-margin">
    <div id="tweet">
        <div id="stats">
            <p>Name: <span class="highlight">Matt Pealing</span><br />
                Born: <span class="highlight">31/03/1986</span><br />
                Location: <span class="highlight">Ellesmere Port, North West UK</span><br />
                Occupation: <span class="highlight">Freelance Designer / Developer</span></p>
        </div>
        <div>
        <p>  
html;
    
twitter_messages('pealo86');
    echo <<<html
    </p>
    <p><a href="http://www.twitter.com/pealo86"><img src="http://twitter-badges.s3.amazonaws.com/follow_me-b.png" alt="Follow pealo86 on Twitter"/></a>
    </p>
    </div>
    </div>
    </div>
html;
    
the_content(); 
}
// cool stuff
elseif(is_page('16')) {
    
$src=bloginfo('template_url');
    echo 
"<img src='$src/image/content-cool-stuff.gif' />";
    
the_content(); 
}
// contact
elseif (is_page('18')) {
    
the_content();
    include (
TEMPLATEPATH '/include/contact/result.php');
    include (
TEMPLATEPATH '/include/contact/process.php');
    include (
TEMPLATEPATH '/include/contact/frm-contact.php');
} else {
    
the_content();
}

?>
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-16-2010, 04:03 PM Re: unexpected T_ELSEIF
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
Thanks that works. I think the problem might have been something to do with all of the includes I was using, which meant it was far too hard to track down the actual problem!

I've decided to ditch all the includes I was using and put everything into separate wordpress template files.

Cheers for the help though.
__________________

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Reply     « Reply to unexpected T_ELSEIF
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18495 seconds with 12 queries