Support Spidean

Do you like our FREE downloads? How about the FREE support for the FREE downloads? Please help us out and donate any amount! It's fast and easy through PayPal.

Spidean Forums

Board Index > Support (.87) > Can we implement a modules title atCommand like the block-title atCommand?


 < Last Thread   Next Thread >New Topic  Post Reply
Author: Subject: Can we implement a modules title atCommand like the block-title atCommand?

Newbie





Posts: 8
Registered: 10/22/2007
Status: Offline

  posted on 11/28/2007 at 04:53 AM
Hi Again.

Is it possible to generate an atCommand for module titles in the same way that the atCommand 'block-title' will generate the title of a block? This would be for PHP-Nuke and version 7.9 if it matters.

Or just some other way of showing the module title and by that I mean the 'custom title' as it appears in the module list rather than the actual module name which is often different or contains underscores etc?

Thank you in advance,

Polski

 
Reply With Quote

Administrator




Posts: 4570
Registered: 10/7/2002
Status: Online

  posted on 11/28/2007 at 04:45 PM
Create a file 'modules/AutoTheme/extras/php-nuke/modtitle.cmd.php' and paste the PHP below in there. You should now be able to use the [modtitle] tag in your templates.


<?php

$db 
$GLOBALS['db'];

$prefix $GLOBALS['prefix'];

$module atGetModName();



$row $db-&gt;sql_fetchrow($db-&gt;sql_query("SELECT custom_title FROM "

.$prefix."_modules WHERE title='$module'"));

$modtitle filter($row['custom_title'], "nohtml");



atRunningSetVar("modtitle"$modtitle);



$extracmd['all'] = array (

    
'modtitle' =&gt'echo $modtitle;',

);

?>


 
Reply With Quote

Newbie




Posts: 8
Registered: 10/22/2007
Status: Offline

  posted on 11/28/2007 at 07:18 PM
Awesome stuff Shawn that worked a treat. Thank you very much.

Just one little extra thing: this doesn't work on the module that is set as 'in Home' - the module you see by default when you just visit the base URL of the PHP-Nuke website. In my case this is the News module. It's not really a big deal except the area where it would otherwise say "News" is empty on the homepage. I'm guessing this is different because of the way the 'in Home' module works. Can the module name be displayed for the 'in Home' module somehow or is this a lot of extra work?

Once again many, many thanks.

 
Reply With Quote

Administrator




Posts: 4570
Registered: 10/7/2002
Status: Online

  posted on 11/28/2007 at 11:07 PM
OK, since I'm giving code for free ;-) try this (donations can be sent to 'paypal AT mckenzies DOT net')


<?php

$db 
$GLOBALS['db'];

$prefix $GLOBALS['prefix'];

$module atGetModName();



// find custom title using module name

$row $db-&gt;sql_fetchrow($db-&gt;sql_query("SELECT custom_title FROM "

.$prefix."_modules WHERE title='$module'"));

$modtitle filter($row['custom_title'], "nohtml");



// if custom title is empty, then look& nbsp;up main module (home module)

// and look up custom title for main&n bsp;module

if(empty($modtitle)) {

    
$row $db-&gt;sql_fetchrow($db-&gt;sql_query("SELECT main_module FROM ".$prefix."_main"));

    
$mainmod filter($row['main_module'], "nohtml");



    
$row $db-&gt;sql_fetchrow($db-&gt;sql_query("SELECT custom_title FROM "

    
.$prefix."_modules WHERE title='$mainmod'"));



    
$modtitle filter($row['custom_title'], "nohtml");

}

// set var

atRunningSetVar("modtitle"$modtitle);



// add command

$extracmd['all'] = array (

    
'modtitle' =&gt'echo $modtitle;',

);

?>



[Edited on 11/29/2007 by Shawn]

 
Reply With Quote

Administrator




Posts: 4570
Registered: 10/7/2002
Status: Online

  posted on 11/28/2007 at 11:12 PM
Well, the forum is acting up and replacing the < with & lt; and the > with & gt; so if you can't figure it out, send my donation and I'll send you a PHP file :-)

-Shawn

[Edited on 11/29/2007 by Shawn]

 
Reply With Quote

Newbie




Posts: 8
Registered: 10/22/2007
Status: Offline

  posted on 11/30/2007 at 05:35 PM
Yeah I figured it out

I did try to repost the code with > instead of & gt; but the preview did nasty things to the website so I just left it.

I said in a pevious post somewhere that I would eventually pay up for the full version which of course I have now done. Didn't think I'd let ya get away with all this free code did you? Was just gonna wait until I needed the caching features when I relaunch my website with it's shiny new AutoTheme theme but your efforts deserve their rewards.

BTW: that last code snippet worked a treat also. I managed to miss the *prefix*_main table somehow when I looked for where the home module is stored.

Thanks again.

 
Reply With Quote
New Topic    Post Reply


Main Menu

Get AutoTheme

Featured Item

Poll

How do you like the new look?

[ Results | Polls ]

Votes: 84
Comments: 0

Powered by the AutoTheme HTML Theme System
Page created in 0.123626 Seconds