I'm in the process of converting a site from a *nuke flavor to Drupal and am running into a few snags... I certainly don't have a desire to rewrite large portions of code in order to convert exsiting stuff. New stuff is another matter entirely.

I'm having two problems with linking... in *nuke you do this:

<a href=\"modules.php?name=$module_name&amp;func=2\">

Since most of what is being done will translate into content pages within Drupal, the end result would be a dynamic link that would be something like "/node/10/func=2"...

A vast amount of the content for the site is written with multiple functions in the content pages and I need a way to be able to access those functions, preferrably without rewriting 900 pages of code.

Thanks... :)

Comments

Dixen’s picture

... I came up with part of my answer. If I add '$node' into the path, like so:

<a href=\"$node\">

I get 'http://www.example.com/node/18/' ... However, I have yet to figure out how exactly to pass the $func variable through to direct the content page to the correction function. Let me explain a lil more as to what I'm doing...

I created a single page in my drupal test site, and copied in some code previously used with a *nuke CMS as a seperate php script... it's a single file with 7 functions and a switch in it... the default function works perfectly (as do all the other functions if I make them the "default") and sets up 5 links to which I want to direct back to the same content page and pass the contents of "$func" so that the switch can load the desired function... It looks something like this:

<?php

global $node;

function go() {
    echo "<ul>";
    echo "<li><a href=\"$node\"></a>";
    echo "<li><a href=\"modules.php?name=$module_name&amp;func=2\"></a>";
    echo "<li><a href=\"modules.php?name=$module_name&amp;func=3\"></a>";
    echo "<li><a href=\"modules.php?name=$module_name&amp;func=4\"></a>";
    echo "<li><a href=\"modules.php?name=$module_name&amp;func=5\"></a>";
    echo "</ul>";
}

function 1() {

... unintresting php code here ...

}

function 2() {

... unintresting php code here ...

}

function 3() {

... unintresting php code here ...

}

function 4() {

... unintresting php code here ...

}

function 5() {

... unintresting php code here ...

}

switch($func) {

    default:
    go();
    break;

    case "1":
    1();
    break;

    case "2":
    2();
    break;

    case "3":
    3();
    break;

    case "4":
    4();
    break;

    case "5":
    5();
    break;
}

?>

Simply replacing "modules.php?name=$module_name" with $node resolves my first issue... now I just need to know how to pass the func portion of the url.

Thanks.

Dixen’s picture

Shameless bump...

Dixen’s picture

Okay, done more work on this and have come up with a couple more things...

<a href=\"$node#/d1\">

The problem with this is that I get this url:

http://www.example.com/node/18#/d1 //notice the "#" sign.

If I do this:

<a href=\"$node/d1\">

I get:

http://www.example.com/d1 //I lose the "node" identifier.

Ultimately the goal will be to use arg() to read the d1 portion of the url and then switch() off that arg to get to the proper function.

Heh, will all the help I'm getting on this one a couple more posts and I will have it all figured out and this will make for a nice item or help if anyone else ever runs into this.