We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Parse Error using Typography class

Development and Programming

TonyNibbles's avatar
TonyNibbles
98 posts
17 years ago
TonyNibbles's avatar TonyNibbles

Hi there,

I’m hoping you can help me.

I have a custom plugin that gets member data, essentially I want to display the {bio} field for a given user. And I’d like to format the text accordingly.

My code currently gets the {bio} field and returns it. However if the {bio} text itself contains a simple URL (e.g: ‘www.google.com) then the following error appears on the page: Parse error: syntax error, unexpected T_STRING in /system/core/core.functions.php(635) : eval()’d code on line 77

It seems whenever it has to auto-format a URL or such, it throws a fit. I’m guessing that I’m doing something wrong with the typography class - but I simply can’t see what it is I should be doing.

An example of the code is such:

$bio = $this->TYPE->parse_type($query->row['bio'], array('text_format'=>'xhtml', 'html_format'=>'all','auto_links'=>'y','allow_img_url'=>'n'));
$text = str_replace('{bio}',$bio, $text);

Previously I discussed some more details about the plugin I have written, in here: http://ellislab.com/forums/viewthread/58374/

Any help much appreciated!

I’m using EE 1.6.

[mod edit: moved to plugin forums]

       
Brian M.'s avatar
Brian M.
529 posts
17 years ago
Brian M.'s avatar Brian M.

Can you post more of your code? Just to make sure, does the typography class work on {bio} when it doesn’t have a URL in it? And just as a caveat - I’m not promising I can help 😉

       
BlackHelix's avatar
BlackHelix
226 posts
17 years ago
BlackHelix's avatar BlackHelix

Why not try my plugin? It works for the forum… I imagine it would work for the member templates as well. here is the link to it

I got it to work fine, I believe.

       
TonyNibbles's avatar
TonyNibbles
98 posts
17 years ago
TonyNibbles's avatar TonyNibbles

Unfortunately I can’t use a different plugin - mine is just too customised.

It does work, its just that URLs in the {bio} field break it.

       
Brian M.'s avatar
Brian M.
529 posts
17 years ago
Brian M.'s avatar Brian M.

What happens if you turn off auto_links when you’re calling Typography - does it still break?

       
Brian M.'s avatar
Brian M.
529 posts
17 years ago
Brian M.'s avatar Brian M.

The second line of code you posted:

$text = str_replace('{bio}',$bio, $text);

Is that so you can return your newly formatted {bio} I’m assuming? Can you post all your code? Looking at that I’m not sure the problem is in how you’re calling the typography class/method.

       
TonyNibbles's avatar
TonyNibbles
98 posts
17 years ago
TonyNibbles's avatar TonyNibbles

Hey Barry,

Thanks for your reply on this. I’ve been tinkering and it looks like my code is just not good enough to do this successfully. I need to rewrite using the template class I think…

hmm, need to put it in a file, I’ll PM you.

Gah. My plugin is rather a mess I think. This is why I’m a designer!

I’ll have to start over and rewrite this plugin at some point, or pick up a copy of SolSpaces “User” Module.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
17 years ago
Lisa Wess's avatar Lisa Wess

I can’t help with the plugin specifically, but perhaps you’d like to post your actual goal? You should be able to output this with the custom profile tag in 1.6.1.

       
TonyNibbles's avatar
TonyNibbles
98 posts
17 years ago
TonyNibbles's avatar TonyNibbles

I run www.crawlofthedead.com, a community site for zombies.

I’ve had to be somewhat rather hacky to achieve my goals. The user profiles however are pretty much exactly as I need them, bar this bug.

The custom profile tag is perhaps useful, but does not include the functionality in my own plugin, which is tailored quite finely for my site. In time, I hope to move to SolSpaces’ extensive User module, so I can remove my hacks and have a ‘safer’ site (which I can upgrade without fear).

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.