Nov 21, 2008, 06:53 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Read what MODx Developers say: MODx Dev. Blogs
Pages: [1]   Go Down
  Print  
Author Topic: [Plugin] AutoLinkRef  (Read 4516 times)
0 Members and 1 Guest are viewing this topic.
Guillaume
Moderators
*
Posts: 711


The future is built today.


« on: Mar 11, 2006, 06:59 PM »

Hello !!

I wrote this plugin to integrate in document and manage easily links towards websites to which I often refers.
So, I suppose it run in chunks (I not test this).

Quote
/* Plugin : AutoLinkRef
 * Version : 1.0
 * Date : 2006-03-12
 * Author : Guillaume Charneau (Guillaume)
 *
 * Short desc : Create links automatically from a reference [-xxxxx-]
 *
 * Installation :
 *      Create a new plugin
 *      Copy and paste this code into
 *      Check OnWebPagePrerender (system events > Template Service Events)
 *
 * Long desc :
 *      This plugin parse the (x)html code to create weblinks from [-linkalias-] tag.
 *      It can add "http://" before url, if you want.
 *      All link attributes can be used to create the link and its context.
 *      Possibility to specify values by default.
 *      Possibility to use or not default values for each link.
 *
 * Example :
 *      [-modx-] can become <a href="www.modxcms.com" class="modxlink" id="linkToModx" lang="en">Modx</a>
 *
 * Todo :
 *      To add an interface to manage parameters
 *      To add table into database for parameters
 */
Regards

Edit (2006-03-12 23:42) : I have modified www.modx.com to www.modxcms.com ; Thanks, davidm.

* plugin.autolinkref.txt (6.86 KB - downloaded 403 times.)
« Last Edit: Jul 20, 2006, 10:42 AM by PaulGregory » Logged

Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
garryn
Coding Team
*
Posts: 1,175



WWW
« Reply #1 on: Mar 11, 2006, 07:08 PM »

Great plugin Guillaume! Thanks for sharing   Smiley

One of those additions that I know will be a timesaver to a lot of people.

Cheers, Garry
Logged

davidm
Marketing & Design Team
*
Posts: 6,733


The best way to predict the future is to invent it


WWW
« Reply #2 on: Mar 12, 2006, 12:23 PM »

It sure will be a time saver !

Just one thing of no importance, in the example : it's modxcms.com not modx.com Wink

It will sure be nice to have this, along with an autolink feature and the phpGiggle thing that's in the hopper Smiley

Logged

.: david-molliere.net : Pour un web libre, moderne et ouvert! :: Forums modxcms.fr : Participez à l'élaboration du site MODx francophone ! :.
! Nouveau !  En live, ne manquez pas les news de modxcms.fr sur Twitter   ! Nouveau !

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.6 | Debian 4.0 (Etch)

Réalisations sous MODx : nodeo.net | pargade-notaires.fr | soleil.info | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | jocelyne-violet.net
bugsmi0
Sr. Member
****
Posts: 354


« Reply #3 on: Jun 22, 2006, 09:25 PM »

I don't suppose this has any features to create a link with a _blank target location ? Grin
Logged

Guillaume
Moderators
*
Posts: 711


The future is built today.


« Reply #4 on: Jun 23, 2006, 04:45 AM »

Hi bugsmi0 Smiley

*      All link attributes can be used to create the link and its context.

You can create a link with all attributes Smiley

An example for your case ; in the code of the snippet plugin you need to add sommething like this :
Code:
$alr_links['grunzig']['text'] = 'grunzig';
$alr_links['grunzig']['title'] = 'Website of Grunzig';
$alr_links['grunzig']['href'] = 'www.grunzig.net';
$alr_links['grunzig']['hreflang'] = 'fr';
$alr_links['grunzig']['target'] = '_blank';
This code will generate this link :
Code:
<a lang="fr" hreflang="fr" title="Website of Grunzig" href="http://www.grunzig.net" target="_blank">grunzig</a>
« Last Edit: Jun 27, 2006, 07:56 AM by Guillaume » Logged

Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
bugsmi0
Sr. Member
****
Posts: 354


« Reply #5 on: Jun 24, 2006, 02:05 AM »

Code:
$alr_links['grunzig']['text'] = 'grunzig';
$alr_links['grunzig']['title'] = 'Website of Grunzig';
$alr_links['grunzig']['href'] = 'www.grunzig.net';
$alr_links['grunzig']['hreflang'] = 'fr';
$alr_links['grunzig']['target'] = '_blank';

what snippet should we put this code in the dropmenu ? does it matter where in the snippet the code goes ?

Logged

Guillaume
Moderators
*
Posts: 711


The future is built today.


« Reply #6 on: Jun 26, 2006, 10:15 AM »

Sorry bugsmi0 but I don't understant your questions. My english is so bad...  Embarrassed
Could you explain what do you want to mean ?

Thanks
Logged

Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
bugsmi0
Sr. Member
****
Posts: 354


« Reply #7 on: Jun 26, 2006, 07:10 PM »

the code above you said to put it inside the snippet, did you mean the dropmenu snippet ? if so where in the dropmenu would this code go

Logged

Guillaume
Moderators
*
Posts: 711


The future is built today.


« Reply #8 on: Jun 27, 2006, 07:56 AM »

Sorry ! I commit an error. You need to put it inside the plugin and not the snippet.

For example, if you put this inside the plugin AutoLinkRef :
Code:
$alr_links['grunzig']['text'] = 'grunzig';
$alr_links['grunzig']['title'] = 'Website of Grunzig';
$alr_links['grunzig']['href'] = 'www.grunzig.net';
$alr_links['grunzig']['hreflang'] = 'fr';
$alr_links['grunzig']['target'] = '_blank';
In a document, this plugin will replace
Quote
[-grunzig-]
by
Quote
<a lang="fr" hreflang="fr" title="Website of Grunzig" href="http://www.grunzig.net" target="_blank">grunzig</a>
Logged

Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!