Welcome to Geeklog Wednesday, August 21 2019 @ 04:32 pm EDT

Geeklog Forums

Dropdown list of static pages in the FCKEditor


Status: offline

phpsocialclub

Forum User
Junior
Registered: 05/03/03
Posts: 30
Location:North Carolina
In order to make it easier for clients to add links to static pages, I have added a drop down menu to the FCKeditor that lists all the static pages on a site. This requires only one new file and one line change to the FCKeditor.

You need to add a file, called CMSlinks.php to the javascript folder in your public_html folder, with the following content

PHP Formatted Code

<?php

/*

By Andrew Gray andrew@graymerica.com

For Geeklog 1.4 with FCKeditor

###INSTALL

Put this file in the {Path to Geeklog HTML}/javascript/ folder

Add the following line to line 41 of {Path to Geeklog HTML}/fckeditor/editor/dialog/fck_link.html

<script src="/javascript/CMSlinks.php"></script>

*/


include("../lib-common.php") ;

//Probably should respect security
 
$sql =  "SELECT sp_id , sp_title FROM {$_TABLES['staticpage']} WHERE 1" ;

$recordset = DB_query($sql) ;
$result = DB_fetchArray(DB_query($sql)) ;

//There is probably a better more GL way to do this

while ($i <= DB_numRows($recordset)) {
   $val = DB_fetchArray($recordset) ;
 
  $url = COM_buildURL ($_CONF['site_url'] . '/staticpages/index.php?page=' . $val[0]);
 
  $staticPagesDropDown .= 'document.write( '<OPTION value="' . $url . '"> ' . htmlentities($val[1]) . ' </OPTION>' );
  '
;
     
   $i++ ;
     
   }
   
 

?>
//### function to change FCKeditor text field when the Drop Down is changed
function CMSdrop()
        {
        var newUrl = GetE('cmslink').value ;
        GetE('txtUrl').value = newUrl ;
        }

//### Write the HTML needed, put here so we do not have to edit much in FCKeditor source       

document.write('<tr><td colspan="3">Internal Link ') ; 
document.write('<select id="cmslink" onChange="CMSdrop();"> ') ;
<?php echo $staticPagesDropDown ; ?>

document.write('</select></td></tr>') ;


 


you need to add one line to the FCKEditor file after that

Please tell me if there are any problems you see or improvements to make
I work for a Wilmington NC Attorney

All times are EDT. The time is now 04:32 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content