Hi @all,
as I learnt a few days ago you can do this only with the MidCOM internal styles. I also had to implement topic-specific images in a MidCOM website. In the layout element <div-titel> I get the name of the actual topic and then the images are put out in small switch.
SG : MyStyle +Sub1 +Sub12 <[show-article]> +Sub2 <[show-article]> ... <[ROOT]> <[content-row]> <[css]> <[div-box]> <[div-content]> <[div-menu]> <[div-titel]> <[div-unten]> <[show-article]>
div-titel looks like the following:
<?php
if (isset($GLOBALS["midcom"]))
$this_topic =
$GLOBALS["midcom"]->get_context_data(MIDCOM_CONTEXT_CONTENTTOPIC);
else
$this_topic = 0; switch ($this_topic->extra) {
case 'Topic1':
?><img src='/Images/FirstTopic.jpg' /><?php
break; case 'Topic2':
?><img src='/Images/SecondTopic.jpg' /><?php
break; default:
?><img src='/Images/DefaultTopic.jpg' /><?php
break;
}
?>Of course you can do it like Henry told, but then you have to use MidCOMs style elements.
greetings, /ingo
|>>-If you create content with MidCOM AIS, it's still possible to edit the |>>article (and the associated style elements) in Aegir, right? |> |>Well, kind of. You shouldn't. MidCOM is a component framework and there |>are a bunch of components for it. These components can store their data |>as Articles, that's right. But this is not mandatory, a component could |>also store data in files or a database. That's what that component thing |>is about, you don't have to deal with the storage, you just use it. | | | So all articles basically have to use the exact same layout? Or is it possible | to write a style element which automatically detects which article or topic | is requested and modifies the layout accordingly? (what I want to do is the | following: All pages on our client's site share the same layout, but each | category has its own logo at the beginning of the article)
Nope, you can use separate layouts. It's pretty easy with MidCOM. Just write yourself a main style (with <[ROOT]> element) and then create child styles (i.e. de.linkm.taviewer) where you remove every <[ROOT]> element and create elements that are supported by the component (see defaults from the snippets: /de/linkm/taviewer/_style/).
Then you create subchildstyles ;) for the different site sections. And the style tree should look something like:
MyStyle - -<[ROOT]> +de.linkm.taviewer - --<[show-article]> ++frontpage - ----<[show-article]> ++subsection - ----<[show-article]>
Then with your styles ready, you must apply them to the topics as a parameter. You can do this in MidCOM AIS too by editing topic and filling the field "style". (i.e. /MyStyle/de.linkm.taviewer/subsection)
That's it, sounds complicated but it's pretty easy when you've done it once. BTW: If you haven't checked Mr. Bergius' Midgard Tutorial slides from OSCOM3, I'd recommend you take a look... http://slideml.bitflux.ch/files/slidesets/499/toc.html
| |>>-If users log in, is it possible to make the login information accessible |>>via mgd_get_person? |> |>I'm not much into Nemein_Authentication, but I guess you can get |>information about the user that's currently logged in ($midgard->user, |>mgd_get_person, ...). What data would you like to access exactly? | | | I need the user's name to display "Welcome Mr/Mrs XXX" on the main page when | s/he logged in
<?php
$person = mgd_get_person($midgard->user); echo "Welcome Mr/Mrs $person->name";
?>
You can replace Mr/Mrs with some extra field or parameter.
| | Bye, | | Andreas |
Cheers!
~ //Henri
- -- Henri Kaukola [EMAIL PROTECTED] Consultant Tel: +358-20-198 6037 Nemein Oy http://www.nemein.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFATfSz3xWc2AolrKgRAsAFAJ4uDd6d88a56ccpxtLKcaAGDLTqfQCeKBen qQPMGgN+scllVOytgAU1P1Y= =bQY4 -----END PGP SIGNATURE-----
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
