Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1813 2011-06-08 20:39:51

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: MLP - The Multi-Lingual Publishing Pack

Hi John.
Another possible approach (not as straight as smd_query) is to output some XML/RSS, and then consume it via smd_xml.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#1814 2011-06-09 17:07:10

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: MLP - The Multi-Lingual Publishing Pack

Thank you Els, Julian!

I’ve used smd_query before and it seems like the wise choice for this case, but I’m having a strange problem.

In SQL, this query works and displays the correct articles:

SELECT * , UNIX_TIMESTAMP( Posted ) AS uPosted, UNIX_TIMESTAMP( LastMod ) AS uLastMod, UNIX_TIMESTAMP( Expires ) AS uExpires
FROM  `textpattern` 
WHERE section =  'military-counseling-news-updates'
AND l10n_lang =  'en-us';

It also works with smd_query, when I’m looking at the English site:

<txp:smd_query
	populate="article"
	column="*,
	     unix_timestamp(Posted) as uPosted,
	     unix_timestamp(LastMod) as uLastMod,
	     unix_timestamp(Expires) as uExpires"
	table="textpattern"
	where="section = 'military-counseling-news-updates' AND l10n_lang = 'en-us'"
	limit="3"><!-- my article tags --></txp:smd_query>

But when I look at the Spanish view, it that smd_query code returns nothing, despite explicitly requesting the en-us content. Do you see any obvious errors?

Thanks again!

Offline

#1815 2011-06-09 18:39:07

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: MLP - The Multi-Lingual Publishing Pack

Does it work with table="l10n_txp_en_us"? Oh wait, I think it may be because you can’t use regular article tags, you need the {Title} etc. kind of thing (see the plugin help).

Last edited by els (2011-06-09 18:41:38)

Offline

#1816 2011-06-09 18:55:48

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: MLP - The Multi-Lingual Publishing Pack

populate="article" normally allows you to use TXP’s article tags, and it is working on in the English view. I’ll check out the other table.

Offline

#1817 2011-06-09 19:01:30

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: MLP - The Multi-Lingual Publishing Pack

johnstephens wrote:

populate="article" normally allows you to use TXP’s article tags

Ah sorry, didn’t know that – who reads Stef’s entire plugin documentation anyway… ;)

Offline

#1818 2011-06-09 19:10:35

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: MLP - The Multi-Lingual Publishing Pack

John, it works for me if I remove the populate="article" and replace the article tags with the {Title} ‘tags’.

Offline

#1819 2011-06-09 19:21:16

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: MLP - The Multi-Lingual Publishing Pack

Thanks! Hmmm— I’m not sure how to deal with the permlinks (wrapping the Title), rss_auto_excerpt, and if_last_article functionality without support for TXP tags.

Offline

#1820 2011-06-09 19:33:15

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: MLP - The Multi-Lingual Publishing Pack

Hmm… you’ve got a point. I’ve been doing permlinks like here, but I can’t think of a solution for the other tags right now. I will think about it some more, but maybe you can ask Stef in the smd_query thread, if there is a way to do it, he’ll know.

Offline

#1821 2011-06-09 19:43:37

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: MLP - The Multi-Lingual Publishing Pack

rvm_substr: <txp:rvm_substr>{Excerpt}</txp:rvm_substr>, though it’s not as sophisticated as rss_auto_excerpt.
And maybe it’s possible to replace the if_last_article with something outside the smd_query tags?

Last edited by els (2011-06-09 19:44:13)

Offline

#1822 2011-06-20 16:42:24

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: MLP - The Multi-Lingual Publishing Pack

Thanks again, Els! I finally got a chance to test this with rvm_substr, and I’m having the same problem. The smd_query output displays flawlessly when viewing the English site, but there is no output when viewing the Spanish site.

Here is the code I’m using in the template that displays the site’s homepage:

<txp:smd_query
	column="*,
	     unix_timestamp(Posted) as uPosted,
	     unix_timestamp(LastMod) as uLastMod,
	     unix_timestamp(Expires) as uExpires"
	table="textpattern"
	where="section = 'my-blog-section' AND l10n_lang = 'en-us'"
	limit="3"><article class="hentry">
<h1 class="entry-title"><a href="<txp:site_url/>en/{Section}/{ID}/{url_title}" rel="bookmark">{Title}</a></h1>
<div class="entry-summary"><txp:variable name="has_excerpt">{Excerpt}</txp:variable>
<txp:if_variable name="has_excerpt" value=""><txp:rvm_substr length="130">{Body_html}</txp:rvm_substr><txp:else/><txp:rvm_substr length="130">{Excerpt}</txp:rvm_substr></txp:if_variable>
<p><a href="<txp:site_url/>en/{Section}/{ID}/{url_title}" rel="bookmark">##read_more##</a></p>
</div> <!-- EO .entry-summary -->
</article>
<hr/>
</txp:smd_query>
<h2><txp:section link="1" name="my-blog-section" title="1"/>&#160;&#187;</h2>

Here is what I have in the tag-trace of the Spanish section:

<txp:smd_query
column="*,
     unix_timestamp(Posted) as uPosted,
     unix_timestamp(LastMod) as uLastMod,
     unix_timestamp(Expires) as uExpires"
table="textpattern"
where="section = 'my-blog-section' AND l10n_lang = 'en-us'"
limit="3">
	[<txp:smd_query
column="*,
     unix_timestamp(Posted) as uPosted,
     unix_timestamp(LastMod) as uLastMod,
     unix_timestamp(Expires) as uExpires"
table="textpattern"
where="section = 'my-blog-section' AND l10n_lang = 'en-us'"
limit="3">: false]
	[SQL (0.000877141952515): select *,
     unix_timestamp(Posted) as uPosted,
     unix_timestamp(LastMod) as uLastMod,
     unix_timestamp(Expires) as uExpires from l10n_txp_es_es where section = 'my-blog-section' AND l10n_lang = 'en-us']
	[<txp:smd_query
column="*,
     unix_timestamp(Posted) as uPosted,
     unix_timestamp(LastMod) as uLastMod,
     unix_timestamp(Expires) as uExpires"
table="textpattern"
where="section = 'my-blog-section' AND l10n_lang = 'en-us'"
limit="3">: true]
	[<txp:smd_query
column="*,
     unix_timestamp(Posted) as uPosted,
     unix_timestamp(LastMod) as uLastMod,
     unix_timestamp(Expires) as uExpires"
table="textpattern"
where="section = 'my-blog-section' AND l10n_lang = 'en-us'"
limit="3">: false]
</txp:smd_query>
<txp:smd_query
column="*,
     unix_timestamp(Posted) as uPosted,
     unix_timestamp(LastMod) as uLastMod,
     unix_timestamp(Expires) as uExpires"
table="textpattern"
where="section = 'my-blog-section' AND l10n_lang = 'en-us'"
limit="3">
	[<txp:smd_query
column="*,
     unix_timestamp(Posted) as uPosted,
     unix_timestamp(LastMod) as uLastMod,
     unix_timestamp(Expires) as uExpires"
table="textpattern"
where="section = 'my-blog-section' AND l10n_lang = 'en-us'"
limit="3">: false]
	[SQL (0.00080394744873): select *,
     unix_timestamp(Posted) as uPosted,
     unix_timestamp(LastMod) as uLastMod,
     unix_timestamp(Expires) as uExpires from l10n_txp_es_es where section = 'my-blog-section' AND l10n_lang = 'en-us']
	[<txp:smd_query
column="*,
     unix_timestamp(Posted) as uPosted,
     unix_timestamp(LastMod) as uLastMod,
     unix_timestamp(Expires) as uExpires"
table="textpattern"
where="section = 'my-blog-section' AND l10n_lang = 'en-us'"
limit="3">: true]
	[<txp:smd_query
column="*,
     unix_timestamp(Posted) as uPosted,
     unix_timestamp(LastMod) as uLastMod,
     unix_timestamp(Expires) as uExpires"
table="textpattern"
where="section = 'my-blog-section' AND l10n_lang = 'en-us'"
limit="3">: false]
</txp:smd_query>

I can’t tell what’s going wrong. Should I report this on the smd_query thread instead, or is there something obvious that I’m doing wrong? It seems odd that the output displays as expected on the English homepage and not on the Spanish homepage.

Thank you!

Offline

#1823 2011-06-20 16:54:25

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: MLP - The Multi-Lingual Publishing Pack

A separate question: Before I upgrade this project to TXP 4.4.1, I want to make sure it’s safe. According to the changelogs, the txplib_db.php file that must be patched for MLP to work hasn’t been updated since Sept 2010. I don’t see any reports of MLP upgrade problems in the 4.4.1 feedback thread, so I take it that it’s clear as long as I use the latest MLP version of txplib_db.php. Is that correct?

Thank you!

Offline

#1824 2011-06-20 17:02:56

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: MLP - The Multi-Lingual Publishing Pack

johnstephens wrote:

I don’t see any reports of MLP upgrade problems in the 4.4.1 feedback thread, so I take it that it’s clear as long as I use the latest MLP version of txplib_db.php. Is that correct?

That is correct. (I only upgraded to the RC, but I assume 4.4.1 will be the same.) I’ll have a look at your other post later this evening.

Last edited by els (2011-06-20 17:03:52)

Offline

Board footer

Powered by FluxBB