Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Php Help

  • 03-08-2010 9:35am
    #1
    Registered Users, Registered Users 2 Posts: 14,006 ✭✭✭✭


    Would someone be so kind as to tell me how to remove the paragraph and class tags from this code in a way that the code will still work. It's from a joomla module but the paragraph tags break the xhtml compliance. I tried to do it but withou success. I'm no coder.
    return $news_text = '<p class="fanews_text '.$class.'">'.$news_text.'</p>';
    }


Comments

  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    Just

    [php]return $news_text;[/php]

    But what exactly is the compliance error. Maybe it would be better fix that than just removing the paragraph?


  • Registered Users, Registered Users 2 Posts: 14,006 ✭✭✭✭The Muppet


    Webmonkey wrote: »
    Just

    [php]return $news_text;[/php]

    But what exactly is the compliance error. Maybe it would be better fix that than just removing the paragraph?

    Thanks for that. It a news module which uses tiny mce to input the text. This automatically puts the text in paragraph tags. This leaves me with paragraph tags within empty paragraph tags which fails xhtml validation.

    That's my take on it anyway, I understand enough to find my way around but as I said I'm no coder . Thank's a million for your help I appreciate it.


    EDIT just implememnted that and it worked a treat

    Thanks again


  • Registered Users, Registered Users 2 Posts: 339 ✭✭spoonface


    The Muppet wrote: »
    Would someone be so kind as to tell me how to remove the paragraph and class tags from this code in a way that the code will still work. It's from a joomla module but the paragraph tags break the xhtml compliance. I tried to do it but withou success. I'm no coder.

    The problem is that you tried to return the result (probably 0) of the operation of assigning a value to a variable. Whereas what you really wanted to do was assign the variable and then return the variable value. The compliance issue is about how anally the PHP installation will check for errors users make and reject them. It's decided you've made a mistake here and it's correct so it flags it as an error and lets you work it out, fix it and run it again. So to be clear, it's not about the paragraph tags, it's about how you did 'return x=y' when you should do 'x=y; return x'.


  • Registered Users, Registered Users 2 Posts: 14,006 ✭✭✭✭The Muppet


    spoonface wrote: »
    The problem is that you tried to return the result (probably 0) of the operation of assigning a value to a variable. Whereas what you really wanted to do was assign the variable and then return the variable value. The compliance issue is about how anally the PHP installation will check for errors users make and reject them. It's decided you've made a mistake here and it's correct so it flags it as an error and lets you work it out, fix it and run it again. So to be clear, it's not about the paragraph tags, it's about how you did 'return x=y' when you should do 'x=y; return x'.

    I think I understand that,I still wouldn't know enough about coding to fix it on my own, I might next time now that it's been explained.

    Removing the class style worked fine this time, I can style it using the site stylesheet. It's on a personal hobby site I like to tinker around with.


Advertisement