Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 06:04:28 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155546 Posts in 21714 Topics by 7736 Members
Latest Member: chris85
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: php help  (Read 415 times)
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« on: May 27, 2011, 03:39:09 PM »

Hi,

I could find a solution on web, or maybe I searched for a wrong term, but how can I wrap a link around text ?

for example, I have this code:
Code:
<a href="..."><div> some text...text ....text .</div></a>
but it doesnt pass validation as I am wrapping block element with inline element. What I am trying to find is how to put a link over text only (inside div tags)
Code:
<div> <a href="...">some text...text ....text .</a></div>


any help would be much appreciated Wink
cheers,
Ivan
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
DarkViper
Development Team
*****
Offline Offline

Posts: 1253


« Reply #1 on: May 27, 2011, 05:49:02 PM »

Block elements within Inline elements are not permitted.
You can handle it maybe, taking a <span> instead of the <div> and set it's display attribute to 'block' or 'inline-block'.
Without guaranty  wink
Logged

Anleitungen lesen und selber nachdenken ist anstrengend...  Da lass ich doch lieber andere für mich denken...

In 1984:  Nineteen Eighty-Four is a unrealistic utopia!!
In 2012:  Nineteen Eighty-Four is a little piece only of our reality!!
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #2 on: May 27, 2011, 06:06:48 PM »

i know,it is a part of template for the module I am working on, the text supposed to be a description, and I need to put a link on description, but then, if description text is aligned: center, I have a block element.. so I am wondering if some experience coder can help on this piece of code.. I found some simular examples with preg match or preg replace, but I havent found a solution for this Sad

What I exactly need:
Code:
$link = '<a href="http://www...."> </a>';
$description = '<div> some <p>dummy text</p>...dummy text ....<span>text</span>......test.... .</div>';

Now I need function to locate pure text and put a link ( $link ) around each peace of text in $description

The result should be something like this:
$description = '<div> <a href="http://www....">some</a> <p><a href="http://www....">dummy text</a></p><a href="http://www....">...dummy text ....</a><span><a href="http://www....">text</a></span><a href="http://www....">......test....</a></div>';

« Last Edit: May 27, 2011, 06:21:51 PM by crnogorac081 » Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!