Hi.
Thanks for pointing me in the right direction (=RTFM). I'm not sure what you
guys like when it comes to the end results, but I'm posting the on the list
so others comming later can use the code. Comments are welcome.


What this function does is to take a topic id and return to variables, var
and lvar, where $lvar is the parent topics to the topic. The code is used to
tell the user where he or she is in the topic structure, and I'm using a
modified version to make links independant of where in the topic tree the
article is.

For many of you this might seem trivial, but I've spent some time on finding
this out. It might be an idea to put the snippet (or something simmilar)
into the midgard documentation.

Tarjei

---------code for getting the topic part of an article link-------
function fvar($article) {
$i = 0;
for ($t = mgd_get_topic($article->topic); $t; $t = mgd_get_topic($t->up)):
$a[];
$a[$i] = "$t->name";
$i++;
endfor;

for ($j=$i-2;$j>-1;--$j): // I did not need the first level in the content
tree, do $j=$i-1 if you want it included
$var;
$lvar .= "$a[$j]/";
$var = "$a[$j]";
endfor;
return $lvar; }



---------Code for a simple location link -----------
<?php
// this code relies on putting a $topic= <topicnum>; into code-init on the
different subpages.
$i = 0;
$lvar = "$url/"; // var brukes til � lage linken
?>
&nbsp;&nbsp;&nbsp;
<a href="http://&;(url);">&(url);: </a><?php
for ($t = mgd_get_topic($topic); $t; $t = mgd_get_topic($t->up)):
$a[];
$a[$i] = "$t->name"; // tror den er rett n�. Skal ikke ha parantes...
$i++;
endfor;

$i = $i - 1; // vi vil ikke ha med nu artikkler i url
?>
<? for ($j=$i-1;$j>-1;--$j):
$var; // var er en string. Navnet p� topicen
$lvar .= "$a[$j]/";
$var = "$a[$j]";
?>
<a href="http://&;(lvar);">&(var);: </a>
<? endfor; ?>


> -----Original Message-----
> From: Tarjei Huse [mailto:[EMAIL PROTECTED]]
> Sent: 17. august 2000 13:47
> To: [EMAIL PROTECTED]
> Subject: [midgard] Copying articles.
>
>
> Hi.
>
> Afte a month in development we're soon finished with our new
> midgard site.
> There's a few things left (SG for one). I got two questions:
> 1. Does anyone have some code for the admin site so that I
> can copy/move an
> article to another topic? As a result of a missunderstanding
> I will need to
> move ca 100 articles around. :-(
>
> 2. Does anyone have a smal pice of code for level independent
> linking? Some
> of my topics have two to four subtopics and I need to be able
> to display
> links to artciles in each level on one page.
>
> 3. Also, does anyone have some code for generic "you are
> here" type of info
> on a page? Like on cnet.com when you go down into the site
> you get something
> like CNET: downloads: pc: linux ....
>
> That's a lot - I'd be greatfull for any advice one theese things.
>
> Tarjei
>
> Webmaster - Friends of the earth Norway.
> www.nu.no
>
>
> --
> This is The Midgard Project's mailing list. For more information,
> please visit the project's web site at http://www.midgard-project.org
>
> To unsubscribe the list, send an empty email message to address
> [EMAIL PROTECTED]


--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org

To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]

Reply via email to