In the Link dialog, there are 3 link types - URL, Anchor and Email.
I want to add another type, Internal URL, for creating links to pages within my CMS.
To do so, I've modified two of the FCKeditor files - these being
/fckeditor/editor/dialog/fck_link/fck_link.js
and
/fckeditor/editor/dialog/fck_link.html
I have added another div for the InternalUrl dialog (ie. choose Internal from the select box and the div for linking to internal pages appears, with a select box showing several preset items. Selecting one of these items and clicking Ok, correctly writes the selected value into a hyperlink tag within the editorarea.
I realise this is probably not the ideal way to go about this, but I am short on time to learn about the plugin features and my hack, so far, is working nicely.
The problem I have is populating the InternalUrl drop-down with the items from my CMS.
I was hoping to just add the necessary ASP functions and a repeater to the select box code, but since the fck_link.html file is .html, this obviously won't work since the page would need to be .asp for the server to run the code and retrieve the records.
Here is the HTML from the fck_link.html file:
Essentially, I need to replace the option values with the ContentIDs from my recordset, so that when creating a new Link, and selecting Internal URL, the drop-down box is populated with the articles from my CMS, each with a unique ID that will be used in the created a href tag (eg. /mywebsite/pages.asp?ContentID=n).
Please, would anyone be able to offer some assistance on how to achieve this within the FCKeditor framework?
ps.
First time poster, wasn't able to search a solution for this, so hope this is not duplicating another post, if so, my apologies.
I want to add another type, Internal URL, for creating links to pages within my CMS.
To do so, I've modified two of the FCKeditor files - these being
/fckeditor/editor/dialog/fck_link/fck_link.js
and
/fckeditor/editor/dialog/fck_link.html
I have added another div for the InternalUrl dialog (ie. choose Internal from the select box and the div for linking to internal pages appears, with a select box showing several preset items. Selecting one of these items and clicking Ok, correctly writes the selected value into a hyperlink tag within the editorarea.
I realise this is probably not the ideal way to go about this, but I am short on time to learn about the plugin features and my hack, so far, is working nicely.
The problem I have is populating the InternalUrl drop-down with the items from my CMS.
I was hoping to just add the necessary ASP functions and a repeater to the select box code, but since the fck_link.html file is .html, this obviously won't work since the page would need to be .asp for the server to run the code and retrieve the records.
Here is the HTML from the fck_link.html file:
<!-- divLinkTypeUrlInternal --> <div id="divLinkTypeUrlInternal"> <table cellspacing="0" cellpadding="0" width="100%" border="0" dir="ltr"> <tr> <td nowrap="nowrap"> </td> <td nowrap="nowrap"> </td> <td nowrap="nowrap" width="100%"> <span fcklang="DlgLnkURLInternal">Internal URL</span><br /> <select id="txtUrlInternal"> <option value="" selected="selected">No article selected</option> <option value="?ContentID=1">title of article 4</option> <option value="?ContentID=2">title of article 4</option> <option value="?ContentID=3">title of article 4</option> <option value="?ContentID=4">title of article 4</option> <option value="?ContentID=5">title of article 5</option> </select> <!--<input id="txtUrl" style="WIDTH: 100%" type="text" onKeyUp="OnUrlChange();" onChange="OnUrlChange();" />--> </td> </tr> </table> <br /> <div id="divBrowseServer"> <input type="button" value="Browse Server" fcklang="DlgBtnBrowseServer" onClick="BrowseServer();" /> </div> </div>
Essentially, I need to replace the option values with the ContentIDs from my recordset, so that when creating a new Link, and selecting Internal URL, the drop-down box is populated with the articles from my CMS, each with a unique ID that will be used in the created a href tag (eg. /mywebsite/pages.asp?ContentID=n).
Please, would anyone be able to offer some assistance on how to achieve this within the FCKeditor framework?
ps.
First time poster, wasn't able to search a solution for this, so hope this is not duplicating another post, if so, my apologies.
Re: Adding a new Link Type - Internal page from CMS
Ok, here is how i get a workaround for the same problem:
Important: Its just a workaround and it works for me. Perhaps someone can create a plugin or something. But this wasn't necessary in my situation.
1. copy "fckeditor/editor/dialog/fck_link.html" to "fckeditor/editor/dialog/fck_link.php"
2. modify the "fck_link.html":
Insert
Re: Adding a new Link Type - Internal page from CMS
Thank you for posting!
Re: Adding a new Link Type - Internal page from CMS
I found your code very useful - but what changes need to be done in the fck_link.js ?
I am using aspx - can u pls provide me with any code to render the cms options dynamically?
Working on a deadline - so any help is very much appreciated.
Thanks a million
Awaitingreply
Re: Adding a new Link Type - Internal page from CMS
Entire code with commented changes beginning from line 505.
Re: Adding a new Link Type - Internal page from CMS
Re: Adding a new Link Type - Internal page from CMS
I have modified it a bit more to allow the Target to be visible as well.code atatched.
Re: Adding a new Link Type - Internal page from CMS
HI,
Lucky I found this post, many thanks for the help so far.
I'm trying to do the same thing, and everything works ok, pages display properly in the drop down list, except that the ok button is disabled in the bottom right corner. Attached is code for fck_link.php.