WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.8 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • General Community »
  • Off-Topic »
  • php help
  • Print
Pages: [1]   Go Down

Author Topic: php help  (Read 5537 times)

Online crnogorac081

  • Posts: 2163
  • Gender: Male
php help
« on: May 27, 2011, 04: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: [Select]
<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: [Select]
<div> <a href="...">some text...text ....text .</a></div>

any help would be much appreciated ;)
cheers,
Ivan
Logged
Web developer

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3087
  • Gender: Female
Re: php help
« Reply #1 on: May 27, 2011, 06: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
Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"We need education to cope with digitalization - and NOT the digitalization of education.!"

Tägliches Stoßgebet: Oh Herr, wirf Hirn vom Himmel !

Online crnogorac081

  • Posts: 2163
  • Gender: Male
Re: php help
« Reply #2 on: May 27, 2011, 07: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 :(

What I exactly need:
Code: [Select]
$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, 07:21:51 PM by crnogorac081 »
Logged
Web developer

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • General Community »
  • Off-Topic »
  • php help
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2