Announcement

Collapse
No announcement yet.

entering links into fragments

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    entering links into fragments

    oh lordy lordy, PLEASE tell me there is a shortcut to entering hyperlinks in html??

    I have a page, split into categories, which has hundreds of hyperlinks entered as an online reference to the "resources" of a book.

    I'm copying and pasting each category (each with its dozens of links) into a fragment where they're going in as just www. etc and then having to hardcode the a href etc around each one...is there really not a shortcut?

    I want a nifty little program that takes all my www dots and converts them into full html hyperlinks (including target="_blank", pretty please)

    anyone got any suggestions or am I really going to be doing this for days?
    Tracey

    #2
    I'll try to cook you up some PHP that looks looks in the Fragment text for www.***.** and generates said link automatically. However it will need to know what to look for. Can you give me some guidelines as to what these URL's look like?
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      I've receiving the info in this format

      Books, Toys, Games

      Barefoot Books www.barefoot-books.com 01225 322 400
      Child's Play www.childs-play.com books 01793 616286
      Fuzzy Duck www.fuzzy-duck.co.uk. 01462 686863
      iChild www.ichild.co.uk 08700 705 291
      Mini IQ www.mini-iq.co.uk 0845 650 2044
      Tish tash toys www.tishtashtoys.com 0870 055 2072


      and I'm having to add the <a href="http:// etc" including target="_blank"> leaving the web address as the link text (as opposed to using the company name as the link)

      So I'm ending up with

      Barefoot Books <a href="http://www.barefoot-books.com" target="_blank">www.barefoot-books.com</a> 01225 322 400<br/>
      etc

      Any help would be hugely appreciated..maybe the automatic generation of hyperlinks for links entered as http:// into fragment (and product) text could be something for the wishlist!

      editted to add...the forum kindly hyperlinked them for me..I wish Actinic would!
      Tracey

      Comment


        #4
        Get them excel formulas ripping, easy stuff Bumpsy. Examples por favor?

        Comment


          #5
          Originally posted by leehack
          Get them excel formulas ripping, easy stuff Bumpsy. Examples por favor?
          examples below (except ignore the forum's kind linking!)
          excel formulas... really not my forté (I seem to be saying that a lot lately I'm starting to wonder what is )
          Tracey

          Comment


            #6
            Right then, have your string in A1, so in A1 would be:

            Barefoot Books www.barefoot-books.co.uk 01225 322 400


            In B1 have just:

            "


            And in C1 have:
            Code:
             =LEFT(A1,FIND("www",A1,1)-1)&"<a href="&B1&"http://"&MID(A1,FIND("www",A1,1),FIND(".co.uk", A1,1)+6-FIND("www",A1,1))&B1&" target="&B1&"_blank"&B1&">"&MID(A1,FIND("www",A1,1),FIND(".co.uk", A1,1)+6-FIND("www",A1,1))&"</a>"&RIGHT(A1,LEN(A1)-(FIND(".co.uk", A1,1)+5))&"<br/>"
            That should do it, all you need to do is copy paste the contents of C1 into your description window.

            Comment


              #7
              Route 2. How to do it within Actinic.

              Copy the Fragment Layout you use to a new layout.

              In that new Layout, replace
              Code:
              		<p><actinic:variable Name="FragmentText"/></p>
              with
              Code:
              		<p><actinic:block php="true">
              $ftext = <<<ENDFRAG
              <actinic:variable Name="FragmentText" selectable="false" />
              ENDFRAG;
              $ftext = str_replace('<br', ' <br', $ftext);
              echo preg_replace('/(www&#46;\S+)/', '<a href="http://$1" target="_blank">$1</a>', $ftext);
              </actinic:block></p>
              And use that new Layout for such fragments.

              The URLS need to be www. followed by everything up to the first space or end of line. So if you have an item with no www, you'll have to fix these manually.

              PS
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                Lee, thank you!!

                I'll give that a go in the morning.
                Just one Q though..how do I make it do the same thing whether it has a .com or .co.uk domain name? so it looks for either, I mean?
                Tracey

                Comment


                  #9
                  Originally posted by NormanRouxel
                  Route 2. How to do it within Actinic.

                  Copy the Fragment Layout you use to a new layout.

                  In that new Layout, replace
                  Code:
                  		<p><actinic:variable Name="FragmentText"/></p>
                  Code:
                  		<p><actinic:block php="true">
                  $ftext = <<<ENDFRAG
                  <actinic:variable Name="FragmentText" selectable="false" />
                  ENDFRAG;
                  echo preg_replace('/(www.\S+)/', '<a href="http://$1" target="_blank">$1</a>', $ftext);
                  </actinic:block></p>
                  And use that new Layout for such fragments.

                  The URLS need to be www. followed by everything up to the first space. So if you have an item with no www or no space after the URL, you'll have to fix these manually.
                  oooh..Norman, I will definitely try that in the morning!

                  Thank you SO much
                  Tracey

                  Comment


                    #10
                    I just improved my post #7 above so best revisit it before using.
                    Norman - www.drillpine.biz
                    Edinburgh, U K / Bitez, Turkey

                    Comment


                      #11
                      Originally posted by budgetbumps
                      Lee, thank you!!

                      I'll give that a go in the morning.
                      Just one Q though..how do I make it do the same thing whether it has a .com or .co.uk domain name? so it looks for either, I mean?
                      That would be a case of an IF statement, decide which method you are going to use first and i will finish it for you if needed. I only did it in excel cos i knew Norman could not resist providing a php solution.

                      Now we both have a php solution, cos php is about as double dutch to me as excel formulas are to you

                      Cheers Norm

                      Comment


                        #12


                        Just to say, couldn't resist the urge and OMG, Norman, thanks a zillion!!
                        MUCH easier to format now, thank you!

                        Lee, I'm going to learn excel formulas, honest
                        Tracey

                        Comment


                          #13
                          Originally posted by budgetbumps
                          Lee, I'm going to learn excel formulas, honest
                          Stuff learning excel, learn php, i have excel covered.

                          Comment


                            #14
                            Originally posted by leehack
                            That would be a case of an IF statement, decide which method you are going to use first and i will finish it for you if needed. I only did it in excel cos i knew Norman could not resist providing a php solution.

                            Now we both have a php solution, cos php is about as double dutch to me as excel formulas are to you

                            Cheers Norm
                            well, tbh, Lee that php route is dead easy so I'll opt for that.
                            I've been learning php actually (Gabe gave me a great site link...which I now can't find but it's around somewhere ) so some of it actually does make sense...it's a whole other thing coming up with it yourself though LOL
                            Tracey

                            Comment


                              #15
                              just wanted to add (I am going to bed soon, honest!) that I just did a whole chapter of links in 5 mins where before it would have taken me the better part of an hour!!

                              w00t!!

                              Everyone should know about that php solution!!
                              Tracey

                              Comment

                              Working...
                              X