Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 19th Oct 2010, 12:37 PM   #1
HyperActive Warrior
War Room Member
 
Join Date: 2010
Posts: 368
Thanks: 107
Thanked 83 Times in 49 Posts
Blog Entries: 2
Default
Getting Error for PHP...need help
Share on: 
fb share twitter share gplus share more share

Hi. I am getting an error on a line of php coding. I do not know what is wrong with it.

Can someone tell me how to fix this?

86: elseif ( is_category() ): 87: echo '<meta name="description" content="'.category_description(get_category_by_slug('category-slug')->term_id).'" />'; 88: endif; 89: ?>

Line 87 is the one with the error.

THanks.
keyconcepts is offline  
Unread 19th Oct 2010, 12:49 PM   #2
Peaceful Warrior
War Room Member
 
theIMgeek's Avatar
 
Join Date: 2009
Location: Calgary
Posts: 277
Thanks: 16
Thanked 106 Times in 63 Posts
Default
Re: Getting Error for PHP...need help
Share on: 
fb share twitter share gplus share more share

Can you tell us what the error message is?

It may be something inside the category_description() or get_category_by_slug() functions... and the error message will hopefully point you to a line number inside that code.

-Ryan

FREE WSO: Protect and Automatically Deliver Your Digital Products

Ask the Internet Marketing Geek
<-- Happy to help with technical challenges
MiniSiteMaker.org <-- Free software to make your mini-sites fast and easy
theIMgeek is offline  
Unread 19th Oct 2010, 01:31 PM   #3
HyperActive Warrior
War Room Member
 
Join Date: 2010
Posts: 368
Thanks: 107
Thanked 83 Times in 49 Posts
Blog Entries: 2
Default
Re: Getting Error for PHP...need help
Share on: 
fb share twitter share gplus share more share

Yes...
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/content/l/a/s/las1277/html/MRC/wp-content/themes/refined/seo.php on line 87

Line 87, as I mentioned previously. Sorry, I meant to tell you what the actual error was.
keyconcepts is offline  
Unread 19th Oct 2010, 01:52 PM   #4
Peaceful Warrior
War Room Member
 
theIMgeek's Avatar
 
Join Date: 2009
Location: Calgary
Posts: 277
Thanks: 16
Thanked 106 Times in 63 Posts
Default
Re: Getting Error for PHP...need help
Share on: 
fb share twitter share gplus share more share

<font color="black">Alright, so it seems to be taking issue with the format of this bit:

PHP Code:
get_category_by_slug('category-slug')->term_id 
If you have not modified this code, it may be that your web host server is running PHP 4.x when this code needs PHP 5.x.

If that's the case, I wonder if a re-format might solve it...

elseif ( is_category() ):
$my_cat_id = get_category_by_slug('category-slug');
echo '<meta name="description" content="'.category_description($my_cat_id->term_id).'" />';
endif;


Maybe!

Or... second thought... it seems odd that it's asking for the id of a category called "category-slug"... you'd think that would be a variable in there.

-Ryan

FREE WSO: Protect and Automatically Deliver Your Digital Products

Ask the Internet Marketing Geek
<-- Happy to help with technical challenges
MiniSiteMaker.org <-- Free software to make your mini-sites fast and easy
theIMgeek is offline  
Unread 19th Oct 2010, 02:01 PM   #5
Web Developer
 
Join Date: 2010
Location: Wisconsin
Posts: 322
Thanks: 2
Thanked 80 Times in 74 Posts
Default
Re: Getting Error for PHP...need help
Share on: 
fb share twitter share gplus share more share

Could you paste 10 lines before and after line 87 in a paste
Pastebin.com - #1 paste tool since 2002! and link it in a post here

Don't add any comments or anything to it, just the code so I can see what is going on.

phpbbxpert is offline  
Unread 19th Oct 2010, 02:45 PM   #6
Automation Specialist
War Room Member
 
caesargus's Avatar
 
Join Date: 2009
Location: Cary, NC
Posts: 153
Thanks: 31
Thanked 13 Times in 13 Posts
Blog Entries: 2
Default
Re: Getting Error for PHP...need help
Share on: 
fb share twitter share gplus share more share

This would be my guess - wrong server version.

A quick way you can tell what version you are using is to create a page with <? phpinfo(); ?> and run the page in your web browser.

If you are running version 5 or greater then we may need more clues as to Is wrong (surrounding code and what not)
caesargus is offline  
Unread 19th Oct 2010, 07:19 PM   #7
HyperActive Warrior
War Room Member
 
Join Date: 2010
Location: Bangalore, India
Posts: 108
Thanks: 2
Thanked 16 Times in 16 Posts
Default
Re: Getting Error for PHP...need help
Share on: 
fb share twitter share gplus share more share

Originally Posted by keyconcepts View Post

Hi. I am getting an error on a line of php coding. I do not know what is wrong with it.

Can someone tell me how to fix this?

86: elseif ( is_category() ): 87: echo '<meta name="description" content="'.category_description(get_category_by_slug('category-slug')->term_id).'" />'; 88: endif; 89: ?>

Line 87 is the one with the error.

THanks.
Why is this ":" there at the end of your line 86 ? If this is present in your php code, then remove it. this seems to be the reason.

SmartWeb is offline  
Unread 19th Oct 2010, 10:26 PM   #8
Automation Specialist
War Room Member
 
caesargus's Avatar
 
Join Date: 2009
Location: Cary, NC
Posts: 153
Thanks: 31
Thanked 13 Times in 13 Posts
Blog Entries: 2
Default
Re: Getting Error for PHP...need help
Share on: 
fb share twitter share gplus share more share

Originally Posted by SmartWeb View Post

Why is this ":" there at the end of your line 86 ? If this is present in your php code, then remove it. this seems to be the reason.
The ":" is at the end of the line because that is valid syntax for PHP. It is an older style of creating if statements. The first time I saw that I had the same reaction.
caesargus is offline  
Closed Thread


Bookmarks

Tags
error, phpneed


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




All times are GMT -6. The time now is 06:22 AM.