Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#109 2009-05-23 22:14:47

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: smd_query: Talk to the database directly via SQL

Turn on debugging mode in admin – preferenses tab. I think there is no column “image” in table textpattern. May be you ment article_image?


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#110 2009-05-23 23:02:40

lous
Member
From: Germany
Registered: 2009-01-04
Posts: 57

Re: smd_query: Talk to the database directly via SQL

i deleted already image in the query :D But still not working

Is it possible, that the problems are the empty “custom_7” field? But at least i got more than 10 articles which got something inside custom_7 so it should work normally hmmmmmm really weird

Last edited by lous (2009-05-23 23:45:01)

Offline

#111 2009-05-23 23:44:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,450
Website GitHub

Re: smd_query: Talk to the database directly via SQL

lous wrote:

i deleted already image in the query :D But still not working

If you have not done so already, do as the_ghost suggests; switch the site to debugging mode. Errors showing up usually point to the cause. If there are no errors/warnings on your page, check the tag trace at the bottom of the source code to see what smd_query is executing. Or put debug="1" in your smd_query tag. Also, check the query returns the rows you expect by copying the SELECT statement from the debug output into phpMyAdmin.

(BTW, you cannot use {Category2} as a replacement tag unless you pull it out of the database in the first place in your SELECT)

Your technique of asking for help and supplying little or no supporting information is not going to attract much help, I’m afraid.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#112 2009-05-24 14:31:37

lous
Member
From: Germany
Registered: 2009-01-04
Posts: 57

Re: smd_query: Talk to the database directly via SQL

<!-- txp tag trace: 
[SQL (0.0120220184326): select name, data from txp_lang where lang='de-de' AND ( event='public' OR event='common')]
[SQL (0.00184392929077): select name, code, version from txp_plugin where status = 1 AND type IN (0,1) order by load_order]
[SQL (0.000324010848999): select name,code,version from txp_plugin where status = 1 AND name='ajw_clean_feed']
[SQL (0.000743865966797): Show tables like 'txp_bot_privs']
[SQL (0.000208854675293): select pref_name, pref_value from txp_bot_privs where 1=1]
[SQL (0.000362873077393): select name,code,version from txp_plugin where status = 1 AND name='mem_admin_parse']
[SQL (0.000582933425903): select name,code,version from txp_plugin where status = 1 AND name='mem_form']
[SQL (0.00025200843811): select name,code,version from txp_plugin where status = 1 AND name='glz_custom_fields']
[SQL (0.00034499168396): select page, css from txp_section where name = 'default' limit 1]
[SQL (0.000370025634766): select user_html from txp_page where name='default']
[Seite: default]
<txp:output_form form="head" />
	[SQL (0.000241994857788): select Form from txp_form where name='head']
	[Baustein: head]
	<txp:page_title />
	<txp:site_slogan />
<txp:output_form form="titlebar" />
	[SQL (0.000174999237061): select Form from txp_form where name='titlebar']
	[Baustein: titlebar]
<txp:output_form form="header" />
	[SQL (0.000144958496094): select Form from txp_form where name='header']
	[Baustein: header]
	<txp:cbs_live_search section="suche" results_max="20" size="25" default_value="Suchbegriff... " results_wraptag="" no_results="Keine Einträge gefunden!" />
<txp:output_form form="navi" />
	[SQL (0.000164031982422): select Form from txp_form where name='navi']
	[Baustein: navi]
	<txp:link_to_home>
	</txp:link_to_home>
	<txp:section link="1" name="Kontakt" url="1" wraptag="li" />
	<txp:section link="1" name="Partner" url="1" wraptag="li" />
	<txp:section link="1" name="RSS" url="1" wraptag="li" />
	<txp:section link="1" name="Atom" url="1" wraptag="li" />
<txp:output_form form="new_download" />
	[SQL (0.000171899795532): select Form from txp_form where name='new_download']
	[Baustein: new_download]
	<txp:smd_query query='SELECT ID, Title, excerpt, Image FROM textpattern WHERE custom_14 = "yes" ORDER BY Posted desc limit 1'>
		[SQL (0.00136303901672): SELECT ID, Title, excerpt, Image FROM textpattern WHERE custom_14 = "yes" ORDER BY Posted desc limit 1]
		[<txp:smd_query query='SELECT ID, Title, excerpt, Image FROM textpattern WHERE custom_14 = "yes" ORDER BY Posted desc limit 1'>: true]
		<txp:permlink id="44">
			[SQL (0.000223159790039): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 44]
		</txp:permlink>
		<txp:permlink id="44">
		</txp:permlink>
	</txp:smd_query>
<txp:output_form form="top5" />
	[SQL (0.000149011611938): select Form from txp_form where name='top5']
	[Baustein: top5]
	<txp:smd_query query='SELECT ID, Title, Image FROM textpattern WHERE custom_15 = "yes" ORDER BY Posted desc limit 5'>
		[SQL (0.00180196762085): SELECT ID, Title, Image FROM textpattern WHERE custom_15 = "yes" ORDER BY Posted desc limit 5]
		[<txp:smd_query query='SELECT ID, Title, Image FROM textpattern WHERE custom_15 = "yes" ORDER BY Posted desc limit 5'>: true]
		<txp:permlink id="72">
			[SQL (0.000234842300415): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 72]
		</txp:permlink>
		<txp:permlink id="22">
			[SQL (0.000152111053467): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 22]
		</txp:permlink>
		<txp:permlink id="9">
			[SQL (0.000245809555054): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 9]
		</txp:permlink>
		<txp:permlink id="8">
			[SQL (0.000192880630493): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 8]
		</txp:permlink>
		<txp:permlink id="4">
			[SQL (0.000164031982422): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 4]
		</txp:permlink>
	</txp:smd_query>
<txp:if_section name="kontakt">
	[<txp:if_section name="kontakt">: false]
</txp:if_section>
<txp:if_section name="partner">
	[<txp:if_section name="partner">: false]
</txp:if_section>
<txp:if_individual_article>
	[<txp:if_individual_article>: false]
</txp:if_individual_article>
<txp:dzd_counter_view force="1" />
	[SQL (0.000144004821777): update textpattern set custom_7='0' where ID='']
<txp:if_article_list>
	[<txp:if_article_list>: true]
	<txp:if_category>
		[<txp:if_category>: false]
		<txp:output_form form="lastuploads" />
			[SQL (0.000152111053467): select Form from txp_form where name='lastuploads']
			[Baustein: lastuploads]
		<txp:output_form form="toptenuploads" />
			[SQL (0.0001380443573): select Form from txp_form where name='toptenuploads']
			[Baustein: toptenuploads]
			<txp:smd_query query='SELECT ID, Title, Category2, custom_1, custom_2, custom_7 FROM textpattern ORDER BY custom_7 desc limit 10'>
				[SQL (0.00077486038208): SELECT ID, Title, Category2, custom_1, custom_2, custom_7 FROM textpattern ORDER BY custom_7 desc limit 10]
				[<txp:smd_query query='SELECT ID, Title, Category2, custom_1, custom_2, custom_7 FROM textpattern ORDER BY custom_7 desc limit 10'>: true]
				<txp:permlink id="37">
					[SQL (0.000172138214111): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 37]
				</txp:permlink>
				<txp:category name="XviD" title="1" link="1" />
					[SQL (0.000173807144165): select title from txp_category where name='XviD' and type='article']
				<txp:permlink id="42">
					[SQL (0.000159978866577): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 42]
				</txp:permlink>
				<txp:category name="XviD" title="1" link="1" />
				<txp:permlink id="7">
					[SQL (0.000159025192261): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 7]
				</txp:permlink>
				<txp:category name="XviD" title="1" link="1" />
				<txp:permlink id="9">
				</txp:permlink>
				<txp:category name="XviD" title="1" link="1" />
				<txp:permlink id="34">
					[SQL (0.000157833099365): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 34]
				</txp:permlink>
				<txp:category name="XviD" title="1" link="1" />
				<txp:permlink id="23">
					[SQL (0.000164985656738): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 23]
				</txp:permlink>
				<txp:category name="XviD" title="1" link="1" />
				<txp:permlink id="27">
					[SQL (0.000342130661011): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted from textpattern where ID = 27]
				</txp:permlink>
				<txp:category name="XviD" title="1" link="1" />
				<txp:permlink id="72">
				</txp:permlink>
				<txp:category name="XviD" title="1" link="1" />
				<txp:permlink id="8">
				</txp:permlink>
				<txp:category name="XviD" title="1" link="1" />
				<txp:permlink id="22">
				</txp:permlink>
				<txp:category name="XviD" title="1" link="1" />
			</txp:smd_query>
	</txp:if_category>
</txp:if_article_list>
<txp:if_category name="filme,dvd,hd,xvid,spiele,adventact,rennspiele,
rollenspiele,sport,serien,serien-dvd,serien-hd,
serien-xvid,programme,windows,mac-osx,xxx,bilder,clips,xxx-filme">
	[<txp:if_category name="filme,dvd,hd,xvid,spiele,adventact,rennspiele,
rollenspiele,sport,serien,serien-dvd,serien-hd,
serien-xvid,programme,windows,mac-osx,xxx,bilder,clips,xxx-filme">: false]
</txp:if_category>
<txp:output_form form="vote_new" />
	[SQL (0.000186204910278): select Form from txp_form where name='vote_new']
	[Baustein: vote_new]
	<txp:link_to_home>
	</txp:link_to_home>
<txp:output_form form="left_side" />
	[SQL (0.000138998031616): select Form from txp_form where name='left_side']
	[Baustein: left_side]
	<txp:adi_cat_menu categories="filme" active_class="active-cat" />
		[SQL (0.000221967697144): select name, title from txp_category where type = 'article' and name in ('filme') order by field(name, 'filme')]
		<txp:article_custom category="Filme"  form="adi_cat_menu_articles" />
			[SQL (0.000933885574341): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('Filme') or Category2 IN ('Filme')) order by Posted desc limit 0, 10]
			[Artikel 106]
			[SQL (0.000137805938721): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Filme"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 105]
			[SQL (0.000117063522339): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Filme"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 104]
			[SQL (0.000114917755127): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Filme"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 102]
			[SQL (0.000113010406494): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Filme"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 101]
			[SQL (0.000226974487305): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Filme"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 100]
			[SQL (0.000163078308105): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Filme"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 99]
			[SQL (0.000117063522339): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Filme"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 98]
			[SQL (0.000118017196655): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Filme"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 97]
			[SQL (0.000116109848022): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Filme"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 96]
			[SQL (0.000113964080811): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Filme"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
	<txp:adi_cat_menu parent="filme" class="subcats" active_class="active-cat" />
		[SQL (0.000317096710205): select lft, rgt from txp_category where name = 'filme']
		[SQL (0.000354051589966): select name, title from txp_category where (lft between 2 and 9) and type = 'article' and name != 'default' and name not in('filme') order by lft ASC]
		<txp:article_custom category="DVD"  form="adi_cat_menu_articles" />
			[SQL (0.0019998550415): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('DVD') or Category2 IN ('DVD')) order by Posted desc limit 0, 10]
		<txp:article_custom category="HD"  form="adi_cat_menu_articles" />
			[SQL (0.00178503990173): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('HD') or Category2 IN ('HD')) order by Posted desc limit 0, 10]
			[Artikel 75]
			[SQL (0.000127792358398): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="HD"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
		<txp:article_custom category="XviD"  form="adi_cat_menu_articles" />
			[SQL (0.000756978988647): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('XviD') or Category2 IN ('XviD')) order by Posted desc limit 0, 10]
			[Artikel 106]
			[SQL (0.000123977661133): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="XviD"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 105]
			[SQL (0.000119924545288): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="XviD"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 104]
			[SQL (0.000118017196655): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="XviD"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 102]
			[SQL (0.00011682510376): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="XviD"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 101]
			[SQL (0.000115871429443): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="XviD"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 100]
			[SQL (0.000266075134277): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="XviD"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 99]
			[SQL (0.00023889541626): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="XviD"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 98]
			[SQL (0.000195026397705): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="XviD"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 97]
			[SQL (0.000126838684082): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="XviD"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 96]
			[SQL (0.000123977661133): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="XviD"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
	<txp:adi_cat_menu categories="spiele" active_class="active-cat" />
		[SQL (0.000302791595459): select name, title from txp_category where type = 'article' and name in ('spiele') order by field(name, 'spiele')]
		<txp:article_custom category="Spiele"  form="adi_cat_menu_articles" />
			[SQL (0.00213217735291): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('Spiele') or Category2 IN ('Spiele')) order by Posted desc limit 0, 10]
			[Artikel 107]
			[SQL (0.000144958496094): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Spiele"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
			[Artikel 55]
			[SQL (0.000118970870972): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Spiele"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
	<txp:adi_cat_menu parent="spiele" class="subcats" active_class="active-cat" />
		[SQL (0.000189065933228): select lft, rgt from txp_category where name = 'spiele']
		[SQL (0.000238180160522): select name, title from txp_category where (lft between 28 and 37) and type = 'article' and name != 'default' and name not in('spiele') order by lft ASC]
		<txp:article_custom category="AdventAct"  form="adi_cat_menu_articles" />
			[SQL (0.00199294090271): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('AdventAct') or Category2 IN ('AdventAct')) order by Posted desc limit 0, 10]
			[Artikel 107]
			[SQL (0.000486135482788): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="AdventAct"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
		<txp:article_custom category="Rennspiele"  form="adi_cat_menu_articles" />
			[SQL (0.00229001045227): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('Rennspiele') or Category2 IN ('Rennspiele')) order by Posted desc limit 0, 10]
		<txp:article_custom category="Rollenspiele"  form="adi_cat_menu_articles" />
			[SQL (0.00195288658142): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('Rollenspiele') or Category2 IN ('Rollenspiele')) order by Posted desc limit 0, 10]
		<txp:article_custom category="Sport"  form="adi_cat_menu_articles" />
			[SQL (0.00194692611694): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('Sport') or Category2 IN ('Sport')) order by Posted desc limit 0, 10]
	<txp:adi_cat_menu categories="serien" active_class="active-cat" />
		[SQL (0.000715970993042): select name, title from txp_category where type = 'article' and name in ('serien') order by field(name, 'serien')]
		<txp:article_custom category="serien"  form="adi_cat_menu_articles" />
			[SQL (0.00206208229065): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('serien') or Category2 IN ('serien')) order by Posted desc limit 0, 10]
			[Artikel 61]
			[SQL (0.00014591217041): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="serien"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
	<txp:adi_cat_menu parent="serien" class="subcats" active_class="active-cat" />
		[SQL (0.000300168991089): select lft, rgt from txp_category where name = 'serien']
		[SQL (0.000417947769165): select name, title from txp_category where (lft between 20 and 27) and type = 'article' and name != 'default' and name not in('serien') order by lft ASC]
		<txp:article_custom category="serien-dvd"  form="adi_cat_menu_articles" />
			[SQL (0.00196409225464): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('serien-dvd') or Category2 IN ('serien-dvd')) order by Posted desc limit 0, 10]
		<txp:article_custom category="serien-hd"  form="adi_cat_menu_articles" />
			[SQL (0.00192213058472): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('serien-hd') or Category2 IN ('serien-hd')) order by Posted desc limit 0, 10]
		<txp:article_custom category="Serien-XviD"  form="adi_cat_menu_articles" />
			[SQL (0.00215697288513): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('Serien-XviD') or Category2 IN ('Serien-XviD')) order by Posted desc limit 0, 10]
			[Artikel 61]
			[SQL (0.000196218490601): select Form from txp_form where name='adi_cat_menu_articles']
			 <txp:article_custom category="Serien-XviD"  form="adi_cat_menu_articles" /> -> Textpattern Notice: Baustein nicht gefunden: adi_cat_menu_articles  on line 1517
	<txp:adi_cat_menu categories="programme" active_class="active-cat" />
		[SQL (0.000262975692749): select name, title from txp_category where type = 'article' and name in ('programme') order by field(name, 'programme')]
		<txp:article_custom category="Programme"  form="adi_cat_menu_articles" />
			[SQL (0.0017831325531): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('Programme') or Category2 IN ('Programme')) order by Posted desc limit 0, 10]
	<txp:adi_cat_menu parent="programme" class="subcats" active_class="active-cat" />
		[SQL (0.000159978866577): select lft, rgt from txp_category where name = 'programme']
		[SQL (0.000198125839233): select name, title from txp_category where (lft between 14 and 19) and type = 'article' and name != 'default' and name not in('programme') order by lft ASC]
		<txp:article_custom category="mac-osx"  form="adi_cat_menu_articles" />
			[SQL (0.0018150806427): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('mac-osx') or Category2 IN ('mac-osx')) order by Posted desc limit 0, 10]
		<txp:article_custom category="windows"  form="adi_cat_menu_articles" />
			[SQL (0.00176811218262): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('windows') or Category2 IN ('windows')) order by Posted desc limit 0, 10]
	<txp:adi_cat_menu categories="xxx" active_class="active-cat" />
		[SQL (0.000211000442505): select name, title from txp_category where type = 'article' and name in ('xxx') order by field(name, 'xxx')]
		<txp:article_custom category="XXX"  form="adi_cat_menu_articles" />
			[SQL (0.00173401832581): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('XXX') or Category2 IN ('XXX')) order by Posted desc limit 0, 10]
	<txp:adi_cat_menu parent="xxx" class="subcats" active_class="active-cat" />
		[SQL (0.000156879425049): select lft, rgt from txp_category where name = 'xxx']
		[SQL (0.000205993652344): select name, title from txp_category where (lft between 38 and 45) and type = 'article' and name != 'default' and name not in('xxx') order by lft ASC]
		<txp:article_custom category="bilder"  form="adi_cat_menu_articles" />
			[SQL (0.00171685218811): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('bilder') or Category2 IN ('bilder')) order by Posted desc limit 0, 10]
		<txp:article_custom category="clips"  form="adi_cat_menu_articles" />
			[SQL (0.00191307067871): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('clips') or Category2 IN ('clips')) order by Posted desc limit 0, 10]
		<txp:article_custom category="xxx-filme"  form="adi_cat_menu_articles" />
			[SQL (0.00197815895081): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('xxx-filme') or Category2 IN ('xxx-filme')) order by Posted desc limit 0, 10]
	<txp:mdn_count category="filme" />
		 <txp:mdn_count category="filme" /> -> Notice: Undefined variable: section  on line 19
		 <txp:mdn_count category="filme" /> -> Notice: Undefined variable: section  on line 22
		 <txp:mdn_count category="filme" /> -> Notice: Undefined variable: intersection  on line 30
		[SQL (0.000439167022705): SELECT COUNT(*) count FROM textpattern WHERE (category1='filme' OR category2='filme') AND status='4']
	<txp:mdn_count category="spiele" />
		 <txp:mdn_count category="spiele" /> -> Notice: Undefined variable: section  on line 19
		 <txp:mdn_count category="spiele" /> -> Notice: Undefined variable: section  on line 22
		 <txp:mdn_count category="spiele" /> -> Notice: Undefined variable: intersection  on line 30
		[SQL (0.000366926193237): SELECT COUNT(*) count FROM textpattern WHERE (category1='spiele' OR category2='spiele') AND status='4']
	<txp:mdn_count category="serien" />
		 <txp:mdn_count category="serien" /> -> Notice: Undefined variable: section  on line 19
		 <txp:mdn_count category="serien" /> -> Notice: Undefined variable: section  on line 22
		 <txp:mdn_count category="serien" /> -> Notice: Undefined variable: intersection  on line 30
		[SQL (0.000383138656616): SELECT COUNT(*) count FROM textpattern WHERE (category1='serien' OR category2='serien') AND status='4']
	<txp:mdn_count category="programme" />
		 <txp:mdn_count category="programme" /> -> Notice: Undefined variable: section  on line 19
		 <txp:mdn_count category="programme" /> -> Notice: Undefined variable: section  on line 22
		 <txp:mdn_count category="programme" /> -> Notice: Undefined variable: intersection  on line 30
		[SQL (0.000358104705811): SELECT COUNT(*) count FROM textpattern WHERE (category1='programme' OR category2='programme') AND status='4']
	<txp:mdn_count category="xxx" />
		 <txp:mdn_count category="xxx" /> -> Notice: Undefined variable: section  on line 19
		 <txp:mdn_count category="xxx" /> -> Notice: Undefined variable: section  on line 22
		 <txp:mdn_count category="xxx" /> -> Notice: Undefined variable: intersection  on line 30
		[SQL (0.000355005264282): SELECT COUNT(*) count FROM textpattern WHERE (category1='xxx' OR category2='xxx') AND status='4']
	<txp:mdn_count section="downloads" />
		 <txp:mdn_count section="downloads" /> -> Notice: Undefined variable: category  on line 19
		 <txp:mdn_count section="downloads" /> -> Notice: Undefined variable: category  on line 25
		 <txp:mdn_count section="downloads" /> -> Notice: Undefined variable: intersection  on line 30
		[SQL (0.000290870666504): SELECT COUNT(*) count FROM textpattern WHERE section='downloads' AND status='4']
<txp:output_form form="footer" />
	[SQL (0.000149011611938): select Form from txp_form where name='footer']
	[Baustein: footer]
[ ~~~ secondpass ~~~ ]
 -->

And what do you mean by i cannot use {Category2}? How else i should show cat2? :D

Offline

#113 2009-05-24 16:54:47

lous
Member
From: Germany
Registered: 2009-01-04
Posts: 57

Re: smd_query: Talk to the database directly via SQL

hmm
When i sort the field “custom_7” in phpmyadmin then i also get a wrong order. I get for example, number: 8,7,56,52,5,4,4…..
Normally it should be in the following order: 56,52,8,7,5,4,….

i solved the prob by adding “+0” :) “custom_7+0”

Last edited by lous (2009-05-24 17:20:07)

Offline

#114 2009-05-24 18:29:17

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,450
Website GitHub

Re: smd_query: Talk to the database directly via SQL

Sorry, I don’t get it. What’s “not working” about that? The tag trace shows that the smd_query is pulling out a bunch of articles and permlinking them, as it should. And it also does it correctly on my test site where I copied your query.

The two queries above that in the tag trace, however, are probably failing because they still contain a column called “Image” which does not exist in the textpattern table (unless you’ve added it?)

And what do you mean by i cannot use {Category2}? How else i should show cat2?

In the query you posted here you are using {Category2} in the container but you have not pulled Category2 out in the list of fields. I was just pointing that out. You appear to be doing it correctly now (according to the tag trace) so again: what is the plugin doing wrong? What do you expect, and what do you see that is different from what you expect?

i also get a wrong order… i solved the prob by adding “+0” :) “custom_7+0”

Yes, sadly that’s the only way to order numerically when you have a VARCHAR field that contains numbers. But it’s a good tip for others running into the same problem, so thanks for sharing it here.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#115 2009-06-10 20:21:30

lous
Member
From: Germany
Registered: 2009-01-04
Posts: 57

Re: smd_query: Talk to the database directly via SQL

hey guys :D

I tried to use this:

<txp:if_category name="<txp:smd_query query='SELECT name FROM txp_category'>{name}</txp:smd_query>">

But it wont work, does anyone know why?

When i use this here:

<txp:smd_query query='SELECT name FROM txp_category'><txp:if_category name="{name}"></txp:smd_query>

It works, but it creates as many <txp:if_category name=”{name}”> as categories are existing, for example when i got 15 cats i get 15 times “<txp:if_category name=”{name}”>”

Thanks in advance :)

Offline

#116 2009-06-10 21:00:02

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,450
Website GitHub

Re: smd_query: Talk to the database directly via SQL

lous

*confused* What are you trying to achieve? Taking your code apart, this piece of SQL:

SELECT name FROM txp_category

Will return every category name in the entire database from images, files, links, and articles. Let’s say you had a zoo website. When you display the results using {name} you would output something like this:

liongiraffepengiunaardvarktiger

and so on, all categories in one long string. If you had the tags-in-tags quoting right — that’s part of the problem but it’s secondary to the bogus query — you then pass all this into if_category. So your tag becomes:

<txp:if_category name="liongiraffepengiunaardvarktiger">

which is clearly not going to return anything!

Please say what it is you are trying to actually accomplish and someone might be able to help you get there.

it creates as many <txp:if_category name=”{name}”> as categories are existing

It will. That’s what the plugin does :-) It takes the number of things you tell it to find and iterates over them one by one. In this case, every single category name in the entire database (of all types).

Last edited by Bloke (2009-06-10 21:04:17)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#117 2009-06-10 21:06:17

lous
Member
From: Germany
Registered: 2009-01-04
Posts: 57

Re: smd_query: Talk to the database directly via SQL

no the output is
lion giraffe pengiun and so on :)

Offline

#118 2009-06-10 21:27:46

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

Re: smd_query: Talk to the database directly via SQL

lous wrote:

<txp:if_category name="<txp:smd_query query='SELECT name FROM txp_category'>{name}</txp:smd_query>">

But it wont work, does anyone know why?

First, use single quotes when using txp tags as attribute values. Second, what are you trying to do? Not that I want to keep you from using Stef’s excellent plugin, but it looks like it can be done with native txp tags.

Do you mean ‘if any category’? Just use <txp:if_category>...</txp:if_category>.

This does the same, but it doesn’t seem very useful: <txp:if_category name='<txp:category_list break=""><txp:category /><txp:if_last_category><txp:else />,</txp:if_last_category></txp:category_list>'>...</txp:if_category>.

Or do you want ‘if current category’? <txp:if_category name='<txp:category />'>...</txp:if_category>.

Offline

#119 2009-06-10 21:39:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,450
Website GitHub

Re: smd_query: Talk to the database directly via SQL

lous wrote:

no the output is lion giraffe pengiun and so on :)

OK, even if that’s the case (hmmm, I might have to fix that – the spaces should not be there unless you tell them to be there) you are still putting:

<txp:if_category name="lion giraffe pengiun aardvark tiger">

into the tag. Again, the if_category tag requires a comma-separated list of names so it won’t work in your case.

As Els says, depending on what you are trying to achieve this is probably doable with native tags-in-tags. Please tell us the effect you want. I can’t figure it out from your code, sorry.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#120 2009-06-10 22:07:07

lous
Member
From: Germany
Registered: 2009-01-04
Posts: 57

Re: smd_query: Talk to the database directly via SQL

sorry guys i was looking to far :)

Sorry, ya it can be done with native tags, my fault :)

Thanks again

Offline

Board footer

Powered by FluxBB