Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Pages: 1 [2] 3 4

Author Topic: Internal links  (Read 24555 times)

mattonik

  • Full Member
  • ***
  • Karma: 7
  • Posts: 123
    • http://www.mattonik.sk
Internal links
« Reply #15 on: April 10, 2007, 08:44:02 PM »

Quote from: keyrocks
@Mattonik - just trying to install this mod now.
Question - where is this located? Could you provide a few lines of code around it?
Quote
"I forgot to call the function in admin area so here is the missing part:
on line 1255 where "echo '

'; is, after this add:
     InterneLinky();
Line locations are not always a good way to reference a location. For instance, line #1255 in my "virgin" snews.php file (downloaded March 04.07) is in function form_articles($contents):
Quote
echo '';
OK... I think I just answered my own question, so here it is for anyone else.
We want to place the following just under the list of HTML Edit button strings. Search for the last of these within function form_articles($contents) and insert the function statement where shown (in blue):
Quote
html_input('button', 'include', '', 'Include', '', 'button', 'onclick="tag(\'include\')"', '', '', '', '', '', '', '', '');
         echo '

';
        InterneLinky();
u are right, i had to add some code around, but you answered it good, that's the place where to put it. thanks for better explanation for everyone. hope it works.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Internal links
« Reply #16 on: April 10, 2007, 08:59:27 PM »

@Mattonik:
Just to let you know that the mod runs just fine in my test-run.
I would suggest one possible improvement though... if I may... we need to manually type in the text for the text-link itself... before the closing a-tag. If you could figure a way to generate the link-title words as the text link as well... then the link insertion would be fully automatic with no need to type anything in at all. :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

mattonik

  • Full Member
  • ***
  • Karma: 7
  • Posts: 123
    • http://www.mattonik.sk
Internal links
« Reply #17 on: April 10, 2007, 10:15:27 PM »

@keyrocks:
so u want that the script to insert the title as a link-text am i right? but the js functions does it. the js function controls if any text is selected in textarea, if yes, it is used as link-text, if nothing is selected, the name of the article or category is used as a link-text.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Internal links
« Reply #18 on: April 10, 2007, 10:26:46 PM »

Here is what I mean. Right now, the link is generated in the textarea as:
Quote
... and it would be great if there was a way to generate the text-link within the string when we click on the link from the link list, so it would look like:
Quote
Install sNews 1.5
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

mattonik

  • Full Member
  • ***
  • Karma: 7
  • Posts: 123
    • http://www.mattonik.sk
Internal links
« Reply #19 on: April 10, 2007, 10:33:48 PM »

@keyrocks: but it is what it does. i found where is the problem, IE has some bug, but  in mozilla it works as u wish. i will try to workout somehow that stupid ie, but not sure i'm good enough...
Logged

mattonik

  • Full Member
  • ***
  • Karma: 7
  • Posts: 123
    • http://www.mattonik.sk
Internal links
« Reply #20 on: April 10, 2007, 10:39:03 PM »

@keyrocks and everybody else: thanks to keyrocks for reporting bug with IE, i changed the js function a little to insert link title as a link text in IE and in Mozilla too. thanks keys
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Internal links
« Reply #21 on: April 11, 2007, 01:18:23 AM »

Shame on me... (always asking others for more details)... I neglected to mention that I was working in IE AND I neglected to test it in Firefox which - BTW - it works OK in. My aplogies... and I'll try your revised script now. (this was quick)
UPDATE: - Works like a charm in IE as well now! :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

piXelatedEmpire

  • MIA
  • ULTIMATE member
  • ******
  • Karma: 37
  • Posts: 1401
  • currently MIA
Internal links
« Reply #22 on: April 11, 2007, 06:56:14 AM »

Quote from: keyrocks
Here is what I mean. Right now, the link is generated in the textarea as:
Quote
... and it would be great if there was a way to generate the text-link within the string when we click on the link from the link list, so it would look like:
Quote
Install sNews 1.5
Actually, this occurs in a default installation of sNews without any MODs when inserting a link - the text for the link is not added.  Possible sNews bug?
Logged
my apologies to the sNews crew, but I will be MIA for the forseeable future

mattonik

  • Full Member
  • ***
  • Karma: 7
  • Posts: 123
    • http://www.mattonik.sk
Internal links
« Reply #23 on: April 11, 2007, 08:10:34 AM »

Quote from: keyrocks
Shame on me... (always asking others for more details)... I neglected to mention that I was working in IE AND I neglected to test it in Firefox which - BTW - it works OK in. My aplogies... and I'll try your revised script now. (this was quick)
UPDATE: - Works like a charm in IE as well now! :)
No need to apologies, if you hadn't work with it in IE i will never know it doesn't work there as it has to. :cool:
Logged

mattonik

  • Full Member
  • ***
  • Karma: 7
  • Posts: 123
    • http://www.mattonik.sk
Internal links
« Reply #24 on: April 11, 2007, 08:16:34 AM »

EDIT  my edited function was buggy, use this one :)

If u are using IE, there is a bug when you wnat to make a link in new article. If no text is selected and u make a new link, the link title wouldn't be used as a link text.
Quote from: piXelatedEmpire
Quote from: keyrocks
Here is what I mean. Right now, the link is generated in the textarea as:
Quote
... and it would be great if there was a way to generate the text-link within the string when we click on the link from the link list, so it would look like:
Quote
Install sNews 1.5
Actually, this occurs in a default installation of sNews without any MODs when inserting a link - the text for the link is not added.  Possible sNews bug?
Not sNews but IE bug. Here is a solution:
in
Code: [Select]
// basic html textarea editor
function tag(tag) {
find this
Code: [Select]
if(!src.setSelectionRange) {
var selected = document.selection.createRange().text;
if(selected.length <= 0) { src.value += start + end;
        } else {
            var codetext = start + selected + end;
            document.selection.createRange().text = codetext;
        }
} else {
        var pretext = src.value.substring(0, src.selectionStart);
        var codetext = start + src.value.substring(src.selectionStart, src.selectionEnd) + end;
        var posttext = src.value.substring(src.selectionEnd, src.value.length)
        if(codetext == start + end)
            codetext = start + end;
            src.value = pretext + codetext + posttext;
    }
src.focus();
}
and change it to this:
Code: [Select]
if(!src.setSelectionRange) {
var selected = document.selection.createRange().text;
if(selected.length <= 0) { src.value += start + title + end;
        } else {
            var codetext = start + selected + end;
            document.selection.createRange().text = codetext;
        }
} else {
        var pretext = src.value.substring(0, src.selectionStart);
        var codetext = start + src.value.substring(src.selectionStart, src.selectionEnd) + end;
        var posttext = src.value.substring(src.selectionEnd, src.value.length)
        if(codetext == start + end)
            codetext = start + title + end;
            src.value = pretext + codetext + posttext;
    }
src.focus();
}
thats all
Logged

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
Internal links
« Reply #25 on: April 11, 2007, 10:26:14 AM »

:cool:  :cool:  :cool:  thank you mattonik,
this is awsome addition to sNews,
working great  :D

best day to all
mo

mattonik

  • Full Member
  • ***
  • Karma: 7
  • Posts: 123
    • http://www.mattonik.sk
Internal links
« Reply #26 on: April 11, 2007, 08:48:39 PM »

that js function i pasted here (one post above) was little buggy, but i made a revision, so use this one :) (you can also find it in "bug report" thread
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Internal links
« Reply #27 on: June 24, 2007, 03:29:48 PM »

@ Mattonik...
This mod has turned out to be very useful as it eliminates the need for a novice user to have to manually create a link to an article, page or category when inserting a link in any content.

Question: How about an Image Links Panel?
Have you given any thought to creating the same functionality for insertion of links to images that have been uploaded to image folders? It would be most useful if... when a user uploads images to designated folders in the site... that the image file-paths were automatically added to links boxes in the same way... then a user could click the link to the image and it would automatically insert the file-path to the image.

And... expanding on this... it would be great to also have an auto image resizing capability working with it so that a novice user could upload and image and it would be automatically re-sized and turned into a low-res image for display purposes. This would be really useful for novice users who do not have imaging software and just want to get the image on the site after placing it on their computer from a digital camera. Even cooler... would be having a small thumbnail beside each image listed in the image links panel.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

mattonik

  • Full Member
  • ***
  • Karma: 7
  • Posts: 123
    • http://www.mattonik.sk
Internal links
« Reply #28 on: June 24, 2007, 05:45:48 PM »

@ keys:
well i was thinking about this once. But than i have forgotten about it :D But thanks for reminding. I found here somewhere a link for light box that can show any content and wondering about using it as image and document panel. I even started with document insert which can be useful too but i had some problems with functions. But anyway, thanks, I may try to make something about this. And thanks for  the idea of thumbnails in image links panel and autoresizing.

Opening my editor and going for it :D
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Internal links
« Reply #29 on: June 24, 2007, 11:56:11 PM »

Quote from: mattonik
@ keys:
Opening my editor and going for it :D
That's the spirit! :)
I suppose if your script worked with... or made use of... GD support... which is usually available on most Apache servers... then that would have something to do with making the re-sizing thingy work?
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU
Pages: 1 [2] 3 4