PHP Web Host - Quality Web Hosting For All PHP Applications Clan Themes! We make clans look good!!
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Rumbaar
Regular
Regular


Joined: Apr 16, 2004
Posts: 78
Location: Melbourne, Australia

PostPosted: Fri Apr 28, 2006 5:38 am Reply with quote Back to top

It's only a small thing, but I think it makes a theme more user friendly and better integrated in the Topics module with theme specific images.

I found that various themes don't make any reference to the possibility for a theme specific topic image, based on defined topic images.

So the minor change needed in your theme.php for the News to display the 'correct' Topic image if available.

For the functions;
function themeindex ()
function themearticle ()

Add in the following code after the global variables.
Code:
    $ThemeSel = get_theme();
    if (@file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
        $t_image = "themes/$ThemeSel/images/topics/$topicimage";
    } else {
        $t_image = "$tipath$topicimage";
    }

The important next step is to modify the theme's reference for displaying the image from most likely $tipath$topicimage to new $t_image variable.

This should make sure that the News page will follow the same display settings you'll find in your Topics module.
View user's profile Send private message Visit poster's website
montego
Former Admin in Good Standing


Joined: Aug 29, 2004
Posts: 9070
Location: Arizona

PostPosted: Fri Apr 28, 2006 5:55 am Reply with quote Back to top

Excellent hack! I have always wondered why my Topics graphics could not be Theme specific. I have also have always wondered about Language specific Topics (because many graphics have text on them too)...
View user's profile Send private message Visit poster's website
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6299
Location: Vsetin, Czech Republic

PostPosted: Fri Apr 28, 2006 6:10 am Reply with quote Back to top

Excellent hack Rumbaar - well done.
That is certainly a useful hack!!
I have made this post a sticky.
View user's profile Send private message Send e-mail Visit poster's website
Rumbaar
Regular
Regular


Joined: Apr 16, 2004
Posts: 78
Location: Melbourne, Australia

PostPosted: Fri Apr 28, 2006 11:09 pm Reply with quote Back to top

Why thank you. I almost didn't post as I thought it was far too simple of an idea and that it would have already been 'common' knowledge among the nuke theme community. I'm glad I did now.

I had been working on various themes for a games site I run and found the images weren't showing up and wondered why. At first I though it was due to my custom themes, but found it applied for various other default themes around the place.

Also another important point I'd like to make is that any theme specific topic images have to be the exact same name and file extension as the 'base' image that was defined when you created the theme.

If there are some coding wizards out there, the only modification I would like to see in the code would be for it to only check the file name excluding the file extension. This will allow for people to use different file types like png, jpg or gif across theme without much issue.
View user's profile Send private message Visit poster's website
montego
Former Admin in Good Standing


Joined: Aug 29, 2004
Posts: 9070
Location: Arizona

PostPosted: Sun Apr 30, 2006 9:47 am Reply with quote Back to top

Personally, I feel that the Topics and News modules should be enhanced to allow for language specific topic icons. But, who has the time...
View user's profile Send private message Visit poster's website
Rumbaar
Regular
Regular


Joined: Apr 16, 2004
Posts: 78
Location: Melbourne, Australia

PostPosted: Sun Apr 30, 2006 9:40 pm Reply with quote Back to top

Enhanced for language specific icons, in the same way the forums allow for language specific icons?

Just a question do you or anyone know if the forums take the language definition from the core php-nuke or from it's own files and includes. I see the {LANG} variable in the icons definition but can't seem to locate where it defines this variable.

If I could find this I'm sure it could be borrowed and with a few tweaks and modifications incorporated into the Topic and Theme/News sections.

I'll continue to look, but it sounds do-able. I'm sure a slightly hard-coded one could be done fairly easily (ie look for a themes/$ThemeSel/images/topics/lang_".$currentlang."/$topicimage as well as the 'default' path/s) but I have to think of all the possibilities that a hard-coded code might not function with.
View user's profile Send private message Visit poster's website
Rumbaar
Regular
Regular


Joined: Apr 16, 2004
Posts: 78
Location: Melbourne, Australia

PostPosted: Mon May 01, 2006 5:42 am Reply with quote Back to top

Ok montego,

'Cause you asked, language specific topic icons. Smile

I'll look to add this hack as a new thread if I can work out which section to put it in. Confused

----------------------------------------------------------------
I have tested this to the best I could, but as I don't use any other language than English I can't say how it will function with 100% certainty with other languages.

Open topics->index.php

find:
Code:
$ThemeSel = get_theme();
    if (@file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
        $t_image = "themes/$ThemeSel/images/topics/$topicimage";
    } else {
        $t_image = "$tipath$topicimage";
    }

and replace with:
Code:
   $ThemeSel = get_theme();
   if (@file_exists("themes/$ThemeSel/images/topics/lang_".$language."/$topicimage")) {
       $t_image = "themes/$ThemeSel/images/topics/lang_".$language."/$topicimage";
   } elseif (@file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
       $t_image = "themes/$ThemeSel/images/topics/$topicimage";
   } elseif (@file_exists("images/topics/lang_".$language."/$topicimage")) {
       $t_image = "images/topics/lang_".$language."/$topicimage";
   } else {
       $t_image = "$tipath$topicimage";
   }


For any theme you are using you'll need to make modifications to the following functions:
function themeindex ()
function themearticle ()

Now if you made the modifications listed in the first post of this thread you'll have to change the code to reflect the new code posted above. You will also have to add the variable $language to the GLOBAL variables in each of the two listed functions.

----------------------------------------------------------------
I've created the code to look for certain files in a specific order to best meet the needs of user.

In order of checking, using english language for examples;
1. theme->topics folder->lang folder - (ie, /html/themes/test/images/topics/lang_english/sample.jpg) - This is for a theme that has a language topic folder(s).
2. theme->topics folder - (ie, /html/themes/test/images/topics/sample.jpg) - This is for a theme that just has base theme specific topic icons.
3. images->topics folder->lang folder - (ie, /html/images/topics/lang_english/sample.jpg) - This is if the default config has language folder(s).
4. images->topics folder - (ie, /html/images/topics/sample.jpg) - This is the base default topic icons.

So all you need to do for your topics theme or language specific images is to create a folder as per example above lang_language. It shoud be as simple as that.
----------------------------------------------------------------
I wasn't quite sure of the difference between $currentlang or $language so I'm not sure of the ramifications across the whole php-nuke coding. If someone can tell me the difference or tips please post.

I hope you and/or others find this useful. I also ask if people can test on multiple languages and let me know if they run into any issues.

Enjoy,
View user's profile Send private message Visit poster's website
Rumbaar
Regular
Regular


Joined: Apr 16, 2004
Posts: 78
Location: Melbourne, Australia

PostPosted: Mon May 01, 2006 4:47 pm Reply with quote Back to top

Actually I was thinking later, to make it more in line with the variable nature of php-nuke it would be best for the 'default' language test to point to the defined Topic image path than the hard coded one I put in.

So I would suggest change:
$t_image = "images/topics/lang_".$language."/$topicimage";

to:

$t_image = "$tipathlang_".$language."/$topicimage";

But I haven't tested this code live yet (due to me being at work), I think the syntax for joining a variabl result with static text might be wrong.
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum