[TYPO3-english] TT_news category menue

Alexander Dick alex at dick.at
Sat Nov 19 13:02:24 CET 2011


Hi Robert, 

for the no-javascript part you could use a <noscript> tag where you put the
submit button inside, so it's only visible if really needed. 

I can't think of any way of redirecting to the selected page without
javascript though, except for a workaround on the server side:

1) create a small extension with the (old) kickstarter
2) insert the plugin of the extension on any hidden page
3) point the form's action to this page, and specify the method as post
4) name the select field whatever you want, but give it a name
5) when you submit the form, it posts the selected value to your inserted
plugin
6) you detect whether it was a valid url posted
(t3lib_div::_POST('yourSelectField'));
7) you make a header redirect to that URL

Looks like a lot of work but I think this can be done in about 30 minutes. 

For the javascript part: 

1) use onchange="if(this.selectedIndex > 0)self.location=this.value"
(no need for the options array access) 

2) for the selected item please try this:

19 = TEXT
 19 {
       value = ">
       override = " selected>
       override { 
           if.value.field = uid
           if.equals.data = GPvar:tx_ttnews|cat
       }
     } 

Regards
Alex


-----Ursprüngliche Nachricht-----
Von: typo3-english-bounces at lists.typo3.org
[mailto:typo3-english-bounces at lists.typo3.org] Im Auftrag von Robert
Wildling
Gesendet: Samstag, 19. November 2011 12:22
An: typo3-english at lists.typo3.org
Betreff: Re: [TYPO3-english] TT_news category menue

At the moment I hae put together sth like this:

getCategories = CONTENT
getCategories {
   table = tt_news_cat
   select {
     pidInList = 17
     where = parent_category=0
     orderBy = title
   }
   renderObj = COA
   renderObj {
     10 = HTML
     10.value = <option value="

     15 = TEXT
     15.insertData = 1
     15.typolink {
       parameter.data = page:uid
       additionalParams = &tx_ttnews[cat]={field:uid}
       additionalParams.insertData = 1
       returnLast = url
       useCacheHash = 1
     }

     17 = HTML
     17.value = "

     19 = TEXT
     19 {
       value =  selected
       if.value.field = uid
       if.equals.data = GPvar:tx_ttnews|cat
     }

     21 = HTML
     21.value = >

     25 = TEXT
     25.data = field:title

     30 = HTML
     30.value = </option>
   }
}

temp.newscats = COA
temp.newscats {
   5 = TEXT
   5.value = <p>Filter:</p><ul><li>

   10 = TEXT
   10.value = <form><fieldset>

   20 = TEXT
   20.value = <label for="destination">Filer:</label>

   30 = TEXT
   30.value = <select onChange="if(this.selectedIndex!=0)
self.location=this.options[this.selectedIndex].value">

   35 = TEXT
   35.value = <option value="0">Alle</option>

   40 < getCategories

   50 = TEXT
   50.value = </select>

   #60 = TEXT
   #60.value = <input name="no_cache" type="hidden" value="1" />

   #70 = TEXT
   #70.value = <input type="button" value="Submit" />

   100 = TEXT
   100.value = </fieldset></form>
}



Works ok, but it seems to me that this solution has two flaws:

1. the parts around the selected area in getCategories (step 19) seems to be
edgy, but no solutions with override that I tried to put togehter worked
out:

     19 = TEXT
     19 {
       value = ">
       override = " selected>
       if.value.field = uid
       if.equals.data = GPvar:tx_ttnews|cat
     }

(and get rid of 17 and 21)
Any ideas what's wrong here?


2. The form work with an onchange command. I cannot think of a solution
without Javascript. The commented-out steps will show a submit button, but
the form won't work. Of yourse, those would need an actions-statement in the
form-tag, but how is that supposed to look? And where would be the condition
that checks whether the button was pressed or not?
I'd be grateful fpr any advice here! Thanks!

Regards, Robert


Am 18.11.11 21:15, schrieb Robert Wildling:
> Hi,
>
> For some reason the tt_news 3.1 CATMENU won't work in my enviroment, 
> so I put sth together myself with lots of help from other forums:
>
> getCategories = CONTENT
> getCategories {
> table = tt_news_cat
> select {
> pidInList = 17
> where = parent_category=0
> orderBy = title
> }
> renderObj = COA
> renderObj {
> 10 = TEXT
> 10.dataWrap = <option value="{field:uid}">{field:title}</option>
> 10.insertData = 1
> }
> }
>
> temp.newscats = COA
> temp.newscats {
> 10 = TEXT
> 10.value = <form id="filter" 
> action="index.php?id=7&tx_ttnews[cat]={--->
> THIS IS THE PROBLEM <---}" method="get"><fieldset>
>
> 20 = TEXT
> 20.value = <label for="destination">Filer:</label>
>
> 30 = TEXT
> 30.value = <select id="destination" name="destination" 
> size="1"><option value="0">Alle</option>
>
> 40 < getCategories
>
> 50 = TEXT
> 50.value = </select>
>
> 60 = TEXT
> 60.value = <input name="no_cache" type="hidden" value="1" />
>
> 70 = TEXT
> 70.value = <input type="button" value="Submit" /></fieldset></form> }
>
>
> The problem is getting the category id into the form action url, so that
> an onchange.command could reload the page and identify the chosen
category.
>
> Furthermore it would be great to include a cHash... ynabody can help here?
> Thanks!
> Regards,
> Robert

_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english



More information about the TYPO3-english mailing list