Viewing the article ... (joomla content items)

Started by kai920, September 09, 2006, 02:09:28 PM

Previous topic - Next topic

kai920

SOLUTION:

Code (working code for smf_integration_arrays.php) Select
$txt['who_article'] = 'Viewing the article <a href="' . ($mosConfig_sef !='1' ? $mosConfig_live_site . '/index.php?option=com_content&amp;task=view&amp;Itemid=%2$s&amp;id=%1$s' : sefReltoAbs ('index.php?option=com_content&amp;task=view&amp;Itemid=%2$s&amp;id=%1$s') . '%2$s/' ) . '">%3$s</a>.';





In the who's online page, it says Viewing the article 27 like so:

Viewing the article 27.

1. The above URL is missing the ItemID of the Joomla menu (correct link: http://www.kaitech.hk/content/view/179/27/)

2. Is it supposed to show "Viewing the article article_title" instead? (or have I misconfigured something?)

Orstio

Did you change something in smf_integration_arrays.php?

This is the code in smf.php that generates that:

$mos_find_article = mysql_query ("SELECT title
FROM {$mosConfig_dbprefix}content
WHERE id = $actions[id]
LIMIT 1");
list ($article_name) = mysql_fetch_row($mos_find_article);
mysql_select_db($db_name);
return sprintf($txt['who_article'], $actions['id'], $actions['Itemid'], $article_name);


So, it definitely gets the article title from the database....

kai920

#2
Hmm, is the smf_integration_arrays.php you speak of in <joomla root>/components/com_smf?

If so, I don't have the above code inside that file !! ???  (a search for $mos_find_article turned up nothing)

edit - found the code in smf.php... mine looks like this (I didn't edit it).


$mos_find_article = mysql_query ("SELECT title
FROM {$mosConfig_dbprefix}content
WHERE id = $actions[id]
LIMIT 1");
list ($article_name) = mysql_fetch_row($mos_find_article);
mysql_select_db($db_name);
return sprintf($txt['who_article'], $actions['id'], $actions['Itemid'], $article_name);



Orstio

In smf_integration_arrays.php, this is the string that it returns:

$txt['who_article'] = 'Viewing the article <a href="' . ($mosConfig_sef !='1' ? $mosConfig_live_site . '/index.php?option=com_content&amp;task=view&amp;id=%d&amp;Itemid=%d' : sefReltoAbs ('index.php?option=com_content&amp;task=view&amp;id=%d&amp;Itemid=%d')) . '">%s</a>.';


As you can see from this code:

return sprintf($txt['who_article'], $actions['id'], $actions['Itemid'], $article_name);


The first two items replaced in $txt['who_article'] are $actions['id'] and $actions['Itemid'], and the last is $article_name. 

kai920

$txt['who_article'] = 'Viewing the article <a href="' . ($mosConfig_sef !='1' ? $mosConfig_live_site . '/index.php?option=com_content&amp;task=view&amp;id=%d&amp;Itemid=%d' : sefReltoAbs ('index.php?option=com_content&amp;task=view&amp;id=%d&amp;Itemid=%d')) . '">%s</a>.';


:S

So what could be wrong? Are my menus setup wrong?

Orstio

#5
Can you check your Joomla content table, and make sure that the field named 'title' of that entry has a value?

And, can you try changing this line in smf.php:

return sprintf($txt['who_article'], $actions['id'], $actions['Itemid'], $article_name);


to this:

return sprintf($txt['who_article'], $actions['id'], intval($actions['Itemid']), $article_name);

kai920

The articles definitely have a value in the 'title' field. No 'title_alias', but that shouldn't affect anything.

Tried adding the intval... but no improvement...

Orstio

It seems to be thinking that Itemid is a string rather than an integer.  If making it an intval doesn't help, then how about we change the definition in smf_integration_arrays.php?

$txt['who_article'] = 'Viewing the article <a href="' . ($mosConfig_sef !='1' ? $mosConfig_live_site . '/index.php?option=com_content&amp;task=view&amp;id=%d&amp;Itemid=%s' : sefReltoAbs ('index.php?option=com_content&amp;task=view&amp;id=%d&amp;Itemid=%s')) . '">%s</a>.';


kai920

No luck. :(

Something must be wrong with my setup? but what could be wrong?

I noticed that categories are not viewed correctly as well.

QuoteViewing the article 56.
Viewing the category 37.

Orstio


kai920

#10
PHP: 4.3.10
Joomla!: 1.0.11 Stable

ps. to recap, viewing articles -- link generated = /content/view/176/, missing the 28 at the end.
who's online shows Viewing the article 28.

viewing category -- link generated = /content/category/0/, missing the 37 at the end.
who's online shows Viewing the category 37.

Orstio

OK, how about like this?

In smf_integration_arrays.php:

$txt['who_article'] = 'Viewing the article <a href="' . ($mosConfig_sef !='1' ? $mosConfig_live_site . '/index.php?option=com_content&amp;task=view&amp;Itemid=%d&amp;id=%d' : sefReltoAbs ('index.php?option=com_content&amp;task=view&amp;Itemid=%d&amp;id=%d')) . '">%s</a>.';

And in smf.php:

return sprintf($txt['who_article'], $actions['Itemid'], $actions['id'], $article_name);


kai920


Orstio

If you look in your smf_log_online table, can you copy the session data from the row with that URL and paste it here so I can see it?

kai920

Sure, is this what you are looking for?

a:5:{s:6:"option";s:11:"com_content";s:4:"task";s:4:"view";s:2:"id";s:2:"13";s:6:"Itemid";s:2:"47";s:10:"USER_AGENT";s:74:"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)";}

Orstio

Yup.  This:

s:6:"Itemid";s:2:"47";

Would indicate that $actions['Itemid'] should be a string -- "47".  They all look like strings in your session, actually, so let's try this in smf_integration_arrays.php:

$txt['who_article'] = 'Viewing the article <a href="' . ($mosConfig_sef !='1' ? $mosConfig_live_site . '/index.php?option=com_content&amp;task=view&amp;Itemid=%s&amp;id=%s' : sefReltoAbs ('index.php?option=com_content&amp;task=view&amp;Itemid=%s&amp;id=%s')) . '">%s</a>.';



kai920

Still no dice. Do I have to clear cache or anything like that?

This is strange cuz no one else seems to have this problem. Must be something with my setup??

Orstio

I don't know.  You don't have an altered SEF component, do you?

How about we force some specifics in the string:

$txt['who_article'] = 'Viewing the article <a href="' . ($mosConfig_sef !='1' ? $mosConfig_live_site . '/index.php?option=com_content&amp;task=view&amp;Itemid=%1$s&amp;id=%2$s' : sefReltoAbs ('index.php?option=com_content&amp;task=view&amp;Itemid=%1$&amp;id=%2$s')) . '">%3$s</a>.';


kai920

No, just the default Joomla SEF.

Anything to do with .htaccess? But there should be nothing in there either relating to the Joomla content URLS.

OK with your code above this post, the String is now correct, but the URL is still not appending the last ItemID/Category ID (Or whatever it is...)

Quote from: who's onlineViewing the article HP iPAQ rx4000 & rx5915

Linked URL: /content/view/177/
Should be: /content/view/177/28/

::) ::) ::)

Orstio

$txt['who_article'] = 'Viewing the article <a href="' . ($mosConfig_sef !='1' ? $mosConfig_live_site . '/index.php?option=com_content&amp;task=view&amp;Itemid=%1$s&amp;id=%2$s' : sefReltoAbs ('index.php?option=com_content&amp;task=view&amp;Itemid=%1$s&amp;id=%2$s')) . '">%3$s</a>.';

Sorry, there was a typo in that last post.   :-[


Advertisement: