1
chefry
Publisher <title>
  • 2012/8/21 15:06

  • chefry

  • Home away from home

  • Posts: 1005

  • Since: 2006/10/14


When looking at a file created by publisher, the name of the website appears in the browser tab.

Is there a mod that will show the file name in the tab?

In HTML it was the <title> tags

2
irmtfan
Re: Publisher <title>
  • 2012/8/22 5:11

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


in publisher now the title is like this in item.php:

<title>item title - Publisher category - publisher module name - xoops site name</title>

if you want to change this look in modules/publisher/item.php around line 186
/**
 * Generating meta information for this page
 */
$publisher_metagen = new PublisherMetagen($itemObj->getVar('title'), $itemObj->getVar('meta_keywords''n'), $itemObj->getVar('meta_description''n'), $itemObj->getCategoryPath());
$publisher_metagen->createMetaTags();


and try to include the

$item['files']
and
$item['embeded_files']

they are array because you can attach many files in one item and you should work to include one specific file or add all file names.



3
chefry
Re: Publisher <title>
  • 2012/8/22 6:05

  • chefry

  • Home away from home

  • Posts: 1005

  • Since: 2006/10/14


Sorry, I guess I misspoke.

When I said file, I mean the item created in Publisher

4
irmtfan
Re: Publisher <title>
  • 2012/8/22 7:52

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


I still dont know what do you want to do?
this is the full title now
<title>item title - Publisher category - publisher module name - xoops site name</title>

if you want to have just item title in the header.
go to publisher/class/metagen.php
and change this function:
function setTitle($title) {
        
$this->_title $this->html2text($title);
        
$this->_original_title $this->_title;
return; 
// added by irmtfan to just return the title

        
$titleTag = array();

        
$titleTag['module'] = $this->publisher->getModule()->getVar('name');

        if (isset(
$this->_title) && ($this->_title != '') && (strtoupper($this->_title) != strtoupper($titleTag['module']))) {
            
$titleTag['title'] = $this->_title;
        }

        if (isset(
$this->_categoryPath) && ($this->_categoryPath != '')) {
            
$titleTag['category'] = $this->_categoryPath;
        }

        
$ret = isset($titleTag['title']) ? $titleTag['title'] : '';

        if (isset(
$titleTag['category']) && $titleTag['category'] != '') {
            if (
$ret != '') {
                
$ret .= ' - ';
            }
            
$ret .= $titleTag['category'];
        }

        if (isset(
$titleTag['module']) && $titleTag['module'] != '') {
            if (
$ret != '') {
                
$ret .= ' - ';
            }
            
$ret .= $titleTag['module'];
        }

        
$this->_title $ret;
    }

the above is just in 10 seconds so maybe not work. please test.

5
chefry
Re: Publisher <title>
  • 2012/8/22 7:57

  • chefry

  • Home away from home

  • Posts: 1005

  • Since: 2006/10/14


when i look at an item in publisher, the only thing i see in the browser tab is the site name. nothing else

it would be nice to see the item name

6
irmtfan
Re: Publisher <title>
  • 2012/8/22 8:18

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


huum strange,
you should have this title in item.php
<title>item title - Publisher category - publisher module name - xoops site name</title>

example:
http://www.xuups.com/modules/publisher/item.php?itemid=28
please update to the latest version if you didnt.
http://xuups.googlecode.com/svn/trunk/modules/publisher

7
Mamba
Re: Publisher <title>
  • 2012/8/22 8:52

  • Mamba

  • Moderator

  • Posts: 11251

  • Since: 2004/4/23


As always, we ask to search first, before asking questions

There is a good chance that the same or similar question has been asked before!

If you would search XOOPS Forums for "Publisher Title", you would find this thread, which I think, would address your issues.

And in the spirit of not just "giving a fish, but teaching how to fish", I also hope, that this will provide an educational value on how to find a variables that you're looking for....
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

8
irmtfan
Re: Publisher <title>
  • 2012/8/22 9:12

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Thanks mamba for pointing out that topic. really helpful.

but it seems his issue is different because the publisher will not show item title which is a bug.
Anyway, this kind of header title is an example of hard-coding (or bad coding) in writing modules.
the true coding should make a hack very very easy.
To do it module developers should define one smarty variable for each php variable.
eg: for publisher we should have something like this in templates:
<title><{$item.title}>-<{$item.cat}> - <{$item.module}> - <{$item.site}></title>
then any webmaster can change it in templates without touching php codes.
maybe it can not be possible in <head> until now in xoops 2.5.5 but the above is just an example of right and easy understandable coding in compare with hard-codes and complex codes.
And pay attention that publisher is an advance module so the old modules are full of hard-codes.
I wish module developers take more time in their projects to remove those hardcodes.


9
Mamba
Re: Publisher <title>
  • 2012/8/22 10:24

  • Mamba

  • Moderator

  • Posts: 11251

  • Since: 2004/4/23


Quote:
but it seems his issue is different because the publisher will not show item title which is a bug.
he probably will need to update his module, as you suggested before, if I remember correctly. Quote:
To do it module developers should define one smarty variable for each php variable. eg: for publisher we should have something like this in templates: <{$item.title}>-<{$item.cat}> - <{$item.module}> - <{$item.site}> then any webmaster can change it in templates without touching php codes.
I think, the issue here was that
<{$xoops_pagetitle}>
was already hardcoded in each theme structure, so Publisher was just taking advantage of it. I am not sure if there is another way to populate the tabs, and how Publisher could access them. Quote:
I wish module developers take more time in their projects to remove those hardcodes.
I agree! And we need to get better in that, but that's what Open Source is all about, i.e. we can help, we can review, we can contribute changes, etc. I hope, our Quality Team, as well as our International Team, will play more and more important role in testing and reviewing modules, before they are approved/certified for release.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

10
irmtfan
Re: Publisher <title>
  • 2012/8/23 4:48

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Your right Mamba about the hardcoded <title> in the themes.
Anyway this hardcode problem (more than one php variable is defined for one smarty) is not limited to the themes. It is generally used in modules/core and make customization very hard especially for new webmasters.
IMO we need to define a theme creating standard for xoops too.
we need a separate topic for that and need to review all themes and discuss about that.

for example about this title issue it is hardcoded in the class/theme.php codes:
$this->template->assign(array(
            
'xoops_theme' => $xoops->getConfig('theme_set'),
            
'xoops_imageurl' => XOOPS_THEME_URL '/' $xoops->getConfig('theme_set') . '/',
            
'xoops_themecss' => $xoops->getCss($xoops->getConfig('theme_set')),
            
'xoops_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES),
            
'xoops_sitename' => htmlspecialchars($xoops->getConfig('sitename'), ENT_QUOTES),
            
'xoops_slogan' => htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES),
            
'xoops_dirname' => $xoops->moduleDirname,
            
'xoops_banner' => $this->renderBanner $xoops->getBanner() : '&nbsp;',
            
'xoops_pagetitle' => $xoops->isModule() ? $xoops->module->getVar('name') : htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES)
        ));
        
$this->template->assign(array(
            
'theme_path' => $this->path,
            
'theme_tpl' => $this->path '/xotpl',
            
'theme_url' => $this->url,
            
'theme_img' => $this->url '/img',
            
'theme_icons' => $this->url '/icons',
            
'theme_css' => $this->url '/css',
            
'theme_js' => $this->url '/js',
            
'theme_lang' => $this->url '/language',
        ));

As you can see we have xoops_slogan smarti variable but again it is used in xoops_pagetitle variable. It is bad coding.

We already have xoops_slogan and xoops_sitename smarties.
we should define a xoops_modulename smarty that back the module name or empty string if the module is not exist:
'xoops_modulename' => $xoops->isModule() ? $xoops->module->getVar('name') : '';


then xoops_array_pagetitle should be an array defined in class/theme.php like this:
$xoops_array_pagetitle = array();
....

'xoops_array_pagetitle' => $xoops_array_pagetitle,

and can be defined for each module separately (can be fully customized eg: page title - page subtitle - cat title - sub cat title - sub sub cat title)
for example for publisher module like this:
$xoops_array_pagetitle['item_title'] = ...
$xoops_array_pagetitle['item_subtitle'] = ...

or for newbb like this:

$xoops_array_pagetitle['post_title'] = ....
$xoops_array_pagetitle['topic_title'] = ....
$xoops_array_pagetitle['cat_title'] = ....
$xoops_array_pagetitle['forum_title'] = ... (sub forums and others included)

then all modules can use the unify below code to assign xoops_array_pagetitle like this:
$xoopsTpl->assign('xoops_array_pagetitle',$xoops_array_pagetitle);

then can be used in all themes like this:
<title>
<{if 
$xoops_array_pagetitle}>
<{
foreachq item=xo_title from=$xoops_array_pagetitle}>
<{
$xo_title}> :
<{/foreach}>
<{/if}>
<!--  
irmtfan for backward compatibility -->
<{if 
$xoops_pagetitle !=''}> <{$xoops_pagetitle}> : <{/if}>
<{
$xoops_modulename}> : <{$xoops_slogan}> : <{$xoops_sitename}> </title>


The above is the final solution for full customization of title in the head without hardcoding.
i can implement the above by modifying class/theme.php and show the use in theme.html or other html like xometas.html

Login

Who's Online

79 user(s) are online (46 user(s) are browsing Support Forums)


Members: 0


Guests: 79


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits