Made some additional changes for those who have multiple installations (and don’t want to have to plug in the database credentials over and over again). It’s not perfect (I whipped it up REALLY quick) nor is it the most ideal method of accessing the database credentials (better way would be to make this an extension or part of the WYGWAM extension that extends the EE framework).
Basically, the new code checks the config file for the database prefix, host, name, user, and password, and uses them appropriately in the mysql queries.
Anyway, here it is:
(assuming your ‘link.php’ file is located at: /themes/wygwam/lib/ckeditor/plugins/link/dialogs/link.php)
Here’s the whole PHP section at the top of the link.php file:
<?php
define(ROOT_PATH,'../../../../../../../'); // path to public root directory (usually htdocs)
define(EXT,'php');
$relative_url = false;
require ROOT_PATH.'path.php';
require substr(ROOT_PATH,0,-2).$system_path.'/config.php';
//UPDATE THESE TO YOUR DB CONNECTION SETTINGS
$connection = mysql_connect($conf['db_hostname'], $conf['db_username'], $conf['db_password']);
mysql_select_db($conf['db_name'], $connection);
$site = mysql_query("SELECT site_system_preferences, site_pages FROM ".$conf['db_prefix']."_sites LIMIT 1");
$siterow = mysql_fetch_array($site);
$site_details = unserialize($siterow['site_system_preferences']);
$site_pages = unserialize($siterow['site_pages']);
//UPDATE THIS QUERY TO INCLUDE ANY OTHER STATUSES THAT YOU MAY HAVE THAT YOU WANT INCLUDED IN THE INTERIOR LINK LIST
$result = mysql_query("SELECT entry_id as id, title as title FROM ".$conf['db_prefix']."_weblog_titles WHERE status IN ('open', 'Sub Menu')");
?>I just followed all the instructions and I can’t get this to work. When I click on the link button nothing happens. Running Wygwam 2.0.2 if that makes any difference. Did anything change recently to make it not work?
EDIT: Sorry to be a bother, I went through everything and resaved and reuploaded and it worked. This is really neat, thanks!
Just a suggestion: Add a dropdown to select from different weblogs, and when a weblog is selected then add a third dropdownt to select entries from it. Thanks again!
hey tony,
dont think the version of wygwam would affect this…but cant say for sure. one thing is that i haven’t tried this with EE2, so not sure if you are on EE2 or not.
two things you can try for testing include:
in FF, if you have the Web Developer Toolbar, you can use the error console to see if you are getting any particular error messages when you click on the link list button.
you can go to: http://www.yourdomain.com/themes/wygwam/lib/ckeditor/plugins/link/dialogs/link.php and see if it spits out any errors that could help you see what the issue is.
Let me know if you have any luck and if not, I’ll try to dig deeper.
Cheers, Dan
Ok I bought Wygwam this morning and gave this a go on the latest build of EE2 but no luck.
I followed all the instructions and everything seemed to go fine but when you go to the editor and click on the ‘Link’ icon nothing happens. All the other controls on Wygwam work fine but just no response on click from ‘Link’.
I ran it again through Firebug and it recognised the following 2 errors.
Line 7 of link.php
invalid regular expression flag h
[Break on this error] <b>Warning</b>: mysql_fetch_array(): .../link.php</b> on line <b>12</b>
\nLine 93 of ckeditor.js
[CKEDITOR.dialog.openDialog] Dialog "link" failed when loading definition.
[Break on this error] k.dialog.vbox.prototype=new k.dialog.h...this._.styleStateChangeCallbacks=[];That’s about as far as my knowledge goes with this. Would be good to get it working in EE2 as it’s a crucial feature for my current project.
Hope this helps
Hey Deeper,
I’ve installed the trial version of EE2 just to play around with first, but since everything is encrypted, its a little difficult to help you out. From what I can tell, there are definitely some coding changes required in the link.php file since there is no “site_pages” field in the “exp_sites” table in EE2 anymore.
You need to figure out where in the DB your page structures are being stored (probably still in serialized format, but maybe they have changed that in EE2). Then change the PHP at the top to pull from the right area.
Send me a direct email if you need more in-depth help on this and maybe I can take a look at your setup directly and see if I can help you out more.
Cheers, Dan
I tried getting it to work in EE2. When you change weblog into channel in link.php there is an interior list, but the URL’s are false: it just puts the selected text in the a href. It would be very nice if this could work in EE2!
I’ve been trying to get this to work with EE2 as well and have also been unable to do so.
If anyone has any luck with this, it would be great if they can post an update in this thread.
Thanks,
Michael
Hey Deeper, I’ve installed the trial version of EE2 just to play around with first, but since everything is encrypted, its a little difficult to help you out. From what I can tell, there are definitely some coding changes required in the link.php file since there is no “site_pages” field in the “exp_sites” table in EE2 anymore. You need to figure out where in the DB your page structures are being stored (probably still in serialized format, but maybe they have changed that in EE2). Then change the PHP at the top to pull from the right area. Send me a direct email if you need more in-depth help on this and maybe I can take a look at your setup directly and see if I can help you out more. Cheers, Dan
Has there been any advances on this? I’ve been away on holiday but still keen to get this feature working now and am willing to help using my install if it gets an answer!
Cheers
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.