This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Idea for module with some example code....

I had idea for an auto link finder for wikipedia when posting article, similar to trillians(the chat client) has as you type. I wrote some test code to test feasibility of making the module, and was able to get a simple and crude sample script working below. Of course, I left alot to anyone who would want to do this. For one, my strips existing formatting and does not go back and put the newly found article link in original. I suppose you could get around this by using a really nice regular expression that to account for html, code, and whatever else before inserting link. Also i could imagine it being implemented similar to the Glossary filter that puts the superscript I beside words found. One thing I have no idea how you could deal with is articles in reference to word found. I think possible ask user which he wants and doesn't. Again, I don't know that is possible to do with an input filter. Of course this was mostly a proof of concept. I am looking at possible writing this into either Windows Live Writer as a plugin or Xinha the WYSWYG editor, again as a plugin. I think it could be more useful there where the user to view article before posting and edit out wikipedia parts that don't apply.

<?php
//try to get info from wikipedia
define('WIKIPEDIAOS','http://en.wikipedia.org/w/api.php?action=opensearch&search=');

function in_arrayi($str, &$array){
$arrReturn = preg_grep('/(?i)'.$str.'/', $array);
return (is_array($arrReturn)) ? $arrReturn[0] : false;
}

function search_wikipedia($term)
{

$str=file_get_contents(WIKIPEDIAOS.$term);
$m = search_str_to_array($term,$str);
return in_arrayi($term,$m);

}

function search_str_to_array(&$term,&$str)
{
$str = substr($str,strlen($term)+4);

$matches = preg_split('/[\[",\]]/',$str,-1,PREG_SPLIT_NO_EMPTY);
return $matches;
}

function split_words(&$str)
{
$words = strip_tags($str);
$words = preg_split('/\W/',$words);
//now loop over words
foreach ($words as &$word)
{
if(strlen($word)>4)
{
$r=search_wikipedia($word);
if ($r)
{
$word="{$word}";
}
}
}
print implode(" ",$words);
}

$str = '

Only local images are allowed.

Launchy is a "keystroke" launcher for windows. Basically, it allows you to quickly launch programs by typing in a few keys of the name. Its works off a hotkey(alt +space), which birngs up a window where you can type a partial name of the intended application, and hit enter to launch. By default, Launchy indexes your desktop and start menu(it reads shortcut files), but it can be set to scan any number of file types and directories. So, for instance, you could have it set to scan all your mp3s and quick launch your favorite song quickly without ever going to windows explorer or your media player. I\'ve been using Launchy for nearly 6 months now, and I can say it has truly changed and improved my computer experience. Also, one aspect of my digital experience it has defiantly freed me from is my scouring start menus and directories for a program I haven\'t used in months. If I can remember part of the name, or even just the icon, I can find it on Launchy. Launchy is available for free over at http://www.launchy.net/, so go get your copy today.

displaying all nodes of a type on front page (4.7.4)

In Drupal 4.7.4, trying to display a front page consisting of one node of type "page" followed by a list of custom nodes. The custom nodes are visible in the db and through administer >> content. I've configured them to promote to the front page, and have set the front page post limit high, but only one custom node displays. I don't know enough to know if this is a settings issue or if I need to build and pass the list of nodes myself somewhere (and if so, where), or something else.

Thanks in advance.

Clark

API: Creating a custom, compond control

I am trying to figure out how to make a compound control. The example I am trying to build is a time selector, which really is a combination of 3 comboboxes:

Combo 1 --> Contains a selector for the hour
Combo 2 --> Contains a selector for the minutes (in this example, in 5 minute increments
Combo 3 --> Contaisn a selector for AM/PM

Private documents, lots of users, frequently updated

Hello everyone,

I'm trying to discover whether I can use an existing module as is, modify one, or whether I need to start from scratch. A company I'm doing some work for is using several Drupal sites for their Intranets, documentation, and even trouble tracking. Now, they'd like to unleash one of these sites on a customer [ insert appropriate smiley here ].

Each customer has potentially several hundred vendors. Each vendor, aside from being able to access public documents on the intranet, needs to be able to view a small handful of reports, updated daily. Given that there will be potentially hundreds of vendors on a site, it would be great if these documents could be keyed by the user's Drupal ID. They log in, see a half a dozen links to consistently named nodes (or records), but no one else can, except the 'super-vendor' who can see all of their vendors' records as well.

Like this :

Vendor1 can see vendor1-report1, vendor1-report2, vendor1-report3
Vendor 2 can see vendor2-report2, vendor2-report2, vendor3-report3
. . . you get the idea.
SuperVendor1 can see everything Vendor1 and Vendor2 can see.

Issues I see are as follows.

- The reports would likely have to be inserted into the appropriate node via a command line SQL update (this part pretty much has to happen in the background).
- I'm guessing the reports would have to be stored with the username as part of the key.

fckeditor work only in edit mode

I have installed fckedito, in admin when I open a page for edit it work;
if I insert an image or change color at text it work;
but how I exit from edit mode I not see no one formatting;
if I return in edit mode I see the previous formatting (image and color)

Worrying entry in my watchdog... (guestbook module)

I found this entry in my logs (page not found);

http://www.mysite.com/guestbook++++++++++++++++++++++++++++++++Result:+%E8%F1%EF%EE%EB%FC%E7%F3%E5%EC+%EF%F0%EE%EA%F1%E8+218.

Which when clicked shows a worrying;

Warning: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' query: SELECT src FROM url_alias WHERE dst = 'guestbook Result: ���������� ������ 218.' in /var/www/localhost/htdocs/includes/database.mysql.inc on line 121

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions