<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[vldPersonals Forum - Show news only in session language]]></title>
	<link rel="self" href="http://www.vldpersonals.com/forum/feed/atom/topic/6873/"/>
	<updated>2010-02-20T23:19:44Z</updated>
	<generator>PunBB</generator>
	<id>http://www.vldpersonals.com/forum/topic/6873/show-news-only-in-session-language/</id>
		<entry>
			<title type="html"><![CDATA[Re: Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/36512/#p36512"/>
			<content type="html"><![CDATA[<p>Very good customization - thanks, <strong>mystec</strong>. <br />But not for all,&nbsp; minimal HTML knowledge is required.<br />By the way, if used HTML editor for addition&nbsp; &lt;div&gt; to news (it&#039;s&nbsp; logically to use it), assignment of variable must be:<br />$filter_lng = &#039;&lt;DIV class=&#039;.$SESSION-&gt;conf[&#039;language&#039;].&#039;-news&#039;; <br />because HTML editor remove &quot; &quot; and write &quot;DIV&quot; instead of &quot;div&quot;.</p>]]></content>
			<author>
				<name><![CDATA[Plebejus]]></name>
				<uri>http://www.vldpersonals.com/forum/user/8105/</uri>
			</author>
			<updated>2010-02-20T23:19:44Z</updated>
			<id>http://www.vldpersonals.com/forum/post/36512/#p36512</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/36257/#p36257"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>radioact wrote:</cite><blockquote><p>I suppose it is. Just edit ext.news.php similar way.</p></blockquote></div><p>This i have allready done, i have news page content respecting sessions language.</p><p>But if i add in homepahe.tpl&nbsp; this :</p><p>&nbsp; &nbsp; &lt;h3 class=&quot;news&quot;&gt;{lang:&quot;core&quot;,&quot;home_latest_news&quot;}&lt;/h3&gt;<br />&nbsp; &nbsp; &lt;div class=&quot;block news&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; {news:limit=5,cache_time=0}<br />&nbsp; &nbsp; &lt;/div&gt;</p><p>I get news in all languages, so no respect for session language on homepage.</p>]]></content>
			<author>
				<name><![CDATA[matrimo]]></name>
				<uri>http://www.vldpersonals.com/forum/user/3118/</uri>
			</author>
			<updated>2010-02-09T23:42:51Z</updated>
			<id>http://www.vldpersonals.com/forum/post/36257/#p36257</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/36249/#p36249"/>
			<content type="html"><![CDATA[<p>I suppose it is. Just edit ext.news.php similar way.</p>]]></content>
			<author>
				<name><![CDATA[radioact]]></name>
				<uri>http://www.vldpersonals.com/forum/user/554/</uri>
			</author>
			<updated>2010-02-09T03:50:11Z</updated>
			<id>http://www.vldpersonals.com/forum/post/36249/#p36249</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/36247/#p36247"/>
			<content type="html"><![CDATA[<p>If i want add Last 5 News on homepage.tpl is possible to have content respecting sessions language too, like in /news/ page ?</p>]]></content>
			<author>
				<name><![CDATA[matrimo]]></name>
				<uri>http://www.vldpersonals.com/forum/user/3118/</uri>
			</author>
			<updated>2010-02-09T00:43:44Z</updated>
			<id>http://www.vldpersonals.com/forum/post/36247/#p36247</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/34089/#p34089"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>rombest wrote:</cite><blockquote><p>It works PERFECT. I recommand it !</p></blockquote></div><p>Nice to see it is working:)</p><p>I have forgotten totalnews because i did not have enough news. I saw it on your site and added it. It will be totally done after replacing one more line. See the first message step 2 please.</p>]]></content>
			<author>
				<name><![CDATA[mystec]]></name>
				<uri>http://www.vldpersonals.com/forum/user/7745/</uri>
			</author>
			<updated>2009-12-01T07:57:14Z</updated>
			<id>http://www.vldpersonals.com/forum/post/34089/#p34089</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/34088/#p34088"/>
			<content type="html"><![CDATA[<p>It works PERFECT. I recommand it !</p>]]></content>
			<author>
				<name><![CDATA[matrimo]]></name>
				<uri>http://www.vldpersonals.com/forum/user/3118/</uri>
			</author>
			<updated>2009-12-01T07:50:31Z</updated>
			<id>http://www.vldpersonals.com/forum/post/34088/#p34088</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/34087/#p34087"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>radioact wrote:</cite><blockquote><p>Oh, actually they will <img src="http://www.vldpersonals.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p></blockquote></div><p>We will see:)</p>]]></content>
			<author>
				<name><![CDATA[mystec]]></name>
				<uri>http://www.vldpersonals.com/forum/user/7745/</uri>
			</author>
			<updated>2009-12-01T07:27:17Z</updated>
			<id>http://www.vldpersonals.com/forum/post/34087/#p34087</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/34086/#p34086"/>
			<content type="html"><![CDATA[<p>Oh, actually they will <img src="http://www.vldpersonals.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[radioact]]></name>
				<uri>http://www.vldpersonals.com/forum/user/554/</uri>
			</author>
			<updated>2009-12-01T07:12:53Z</updated>
			<id>http://www.vldpersonals.com/forum/post/34086/#p34086</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/34085/#p34085"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>radioact wrote:</cite><blockquote><p>It&#039;s good enough and easy to reapply on every new vldP version if it comes.<br />One suggestion to try:<br /></p><div class="codebox"><pre><code>AND body LIKE &#039;%$filter_lng%&#039;</code></pre></div><p>Could be:<br /></p><div class="codebox"><pre><code>AND body LIKE &#039;$filter_lng%&#039;</code></pre></div><p>This will search only at beginning of news body.<br />Because of we put &lt;div class=&quot;english-news&quot;&gt; at the start no need to seek it all over the news body text.</p></blockquote></div><p>Edited it. I hope people wont add &lt;div class=&quot;.. after that default &lt;br&gt;</p>]]></content>
			<author>
				<name><![CDATA[mystec]]></name>
				<uri>http://www.vldpersonals.com/forum/user/7745/</uri>
			</author>
			<updated>2009-12-01T06:52:26Z</updated>
			<id>http://www.vldpersonals.com/forum/post/34085/#p34085</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/34082/#p34082"/>
			<content type="html"><![CDATA[<p>It&#039;s good enough and easy to reapply on every new vldP version if it comes.<br />One suggestion to try:<br /></p><div class="codebox"><pre><code>AND body LIKE &#039;%$filter_lng%&#039;</code></pre></div><p>Could be:<br /></p><div class="codebox"><pre><code>AND body LIKE &#039;$filter_lng%&#039;</code></pre></div><p>This will search only at beginning of news body.<br />Because of we put &lt;div class=&quot;english-news&quot;&gt; at the start no need to seek it all over the news body text.</p>]]></content>
			<author>
				<name><![CDATA[radioact]]></name>
				<uri>http://www.vldpersonals.com/forum/user/554/</uri>
			</author>
			<updated>2009-12-01T06:40:16Z</updated>
			<id>http://www.vldpersonals.com/forum/post/34082/#p34082</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/34081/#p34081"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>radioact wrote:</cite><blockquote><p>Nice and easy to implement solution. Approved! <img src="http://www.vldpersonals.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p></blockquote></div><p>Yes, this is the easiest way i think, sure not the most professional one <img src="http://www.vldpersonals.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[mystec]]></name>
				<uri>http://www.vldpersonals.com/forum/user/7745/</uri>
			</author>
			<updated>2009-12-01T06:26:41Z</updated>
			<id>http://www.vldpersonals.com/forum/post/34081/#p34081</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/34079/#p34079"/>
			<content type="html"><![CDATA[<p>Nice and easy to implement solution. Approved! <img src="http://www.vldpersonals.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[radioact]]></name>
				<uri>http://www.vldpersonals.com/forum/user/554/</uri>
			</author>
			<updated>2009-12-01T06:10:01Z</updated>
			<id>http://www.vldpersonals.com/forum/post/34079/#p34079</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Show news only in session language]]></title>
			<link rel="alternate" href="http://www.vldpersonals.com/forum/post/34071/#p34071"/>
			<content type="html"><![CDATA[<p>Hi,</p><p>Yesterday there was a topic someone (i think rombest) asking how it would be possible to show news only in users language. But now i can not find that topic. I hope it was not a dream.</p><p>Here the solution is:</p><p>1. Open ext.news.php</p><p>Find:<br /></p><div class="codebox"><pre><code>        $result = $DB-&gt;query(&quot;SELECT * FROM &quot; . DB_PREFIX . &quot;news WHERE active=&#039;1&#039; ORDER BY $orderby $orderdir LIMIT $limit&quot;);</code></pre></div><p>Replace:<br /></p><div class="codebox"><pre><code>        $filter_lng = &#039;&lt;div class=&quot;&#039;.$SESSION-&gt;conf[&#039;language&#039;].&#039;-news&quot;&#039;;
        $result = $DB-&gt;query(&quot;SELECT * FROM &quot; . DB_PREFIX . &quot;news WHERE active=&#039;1&#039; AND body LIKE &#039;$filter_lng%&#039; ORDER BY $orderby $orderdir LIMIT $limit&quot;);</code></pre></div><p>2. Open lib.news.php</p><p>Find:<br /></p><div class="codebox"><pre><code>            $result = $DB-&gt;query(&quot;SELECT * FROM &quot; . DB_PREFIX . &quot;news WHERE active=&#039;1&#039; ORDER BY postdate DESC, news_id DESC LIMIT &quot; . (($page - 1) * $PREFS-&gt;conf[&#039;news_per_page&#039;]) . &quot;, &quot; . $PREFS-&gt;conf[&#039;news_per_page&#039;]);</code></pre></div><p>Replace:<br /></p><div class="codebox"><pre><code>$filter_lng = &#039;&lt;div class=&quot;&#039;.$SESSION-&gt;conf[&#039;language&#039;].&#039;-news&quot;&#039;;
$result = $DB-&gt;query(&quot;SELECT * FROM &quot; . DB_PREFIX . &quot;news WHERE active=&#039;1&#039; AND body LIKE &#039;$filter_lng%&#039; ORDER BY postdate DESC, news_id DESC LIMIT &quot; . (($page - 1) * $PREFS-&gt;conf[&#039;news_per_page&#039;]) . &quot;, &quot; . $PREFS-&gt;conf[&#039;news_per_page&#039;]);</code></pre></div><p><strong>(For totalpages)</strong><br />Find:<br /></p><div class="codebox"><pre><code>$result = $DB-&gt;query(&quot;SELECT COUNT(*) as total FROM &quot; . DB_PREFIX . &quot;news WHERE active=&#039;1&#039;&quot;);</code></pre></div><p>Replace:<br /></p><div class="codebox"><pre><code>$filter_lng = &#039;&lt;div class=&quot;&#039;.$SESSION-&gt;conf[&#039;language&#039;].&#039;-news&quot;&#039;;
$result = $DB-&gt;query(&quot;SELECT COUNT(*) as total FROM &quot; . DB_PREFIX . &quot;news WHERE active=&#039;1&#039; AND body LIKE &#039;$filter_lng%&#039;&quot;);</code></pre></div><p>3. While publishing news, at body section use the structure below.</p><p>Example English: &lt;div class=&quot;english-news&quot;&gt;English news body bla bla bla... &lt;/div&gt;</p><p>Example French: &lt;div class=&quot;french-news&quot;&gt;French news body bla bla bla... &lt;/div&gt;</p><p>Example Turkish: &lt;div class=&quot;turkish-news&quot;&gt;Turkish news body bla bla bla... &lt;/div&gt;</p><p>If you have any questions feel free to ask.</p><p>Note: This could be done with adding an extra field for news too. But i think this is easier. </p><p>Important: Be sure news body starts with &lt;div class=&quot; not with &lt;br&gt;</p>]]></content>
			<author>
				<name><![CDATA[mystec]]></name>
				<uri>http://www.vldpersonals.com/forum/user/7745/</uri>
			</author>
			<updated>2009-12-01T02:50:10Z</updated>
			<id>http://www.vldpersonals.com/forum/post/34071/#p34071</id>
		</entry>
</feed>

