We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

WYGWAM Internal Link List

Development and Programming

Jarrett Barnett's avatar
Jarrett Barnett
31 posts
about 16 years ago
Jarrett Barnett's avatar Jarrett Barnett

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')");
?>
       
luke holder's avatar
luke holder
71 posts
about 16 years ago
luke holder's avatar luke holder

Does this work with WYGWAm for EE2?

       
theVitalPath's avatar
theVitalPath
23 posts
about 16 years ago
theVitalPath's avatar theVitalPath

@Jarrett: awesome additions! thanks for sharing…dunno why i didnt think of that for the DB connection part…good thinking!

@luke: havent tried in EE2 yet…anyone else tried with EE2? im curious myself.

       
Tony Geer's avatar
Tony Geer
253 posts
15 years ago
Tony Geer's avatar Tony Geer

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!

       
theVitalPath's avatar
theVitalPath
23 posts
15 years ago
theVitalPath's avatar theVitalPath

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:

  1. 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.

  2. 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

       
Tony Geer's avatar
Tony Geer
253 posts
15 years ago
Tony Geer's avatar Tony Geer

Hey Dan thanks for the quick reply! I just edited my post to say it’s working and thanks!

       
Deeper's avatar
Deeper
215 posts
15 years ago
Deeper's avatar Deeper

This is exactly what I’m looking for. Can anybody confirm if this works with EE2?

Thanks

       
Deeper's avatar
Deeper
215 posts
15 years ago
Deeper's avatar Deeper

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>
\n

Line 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

       
theVitalPath's avatar
theVitalPath
23 posts
15 years ago
theVitalPath's avatar theVitalPath

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

       
Sjoerd's avatar
Sjoerd
233 posts
15 years ago
Sjoerd's avatar Sjoerd

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!

       
AlbSar's avatar
AlbSar
1 posts
15 years ago
AlbSar's avatar AlbSar
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

       
justjess's avatar
justjess
16 posts
15 years ago
justjess's avatar justjess

Does this work if you don’t use pages or structure? After I tried it nothing happened so I looked at the database, and the site_pages field isn’t even created if you don’t install the Pages module… which I never do.

       
Deeper's avatar
Deeper
215 posts
15 years ago
Deeper's avatar Deeper
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

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.