[TYPO3-english] TT_news category menue

Robert Wildling robertwildling at gmail.com
Sat Nov 19 12:22:17 CET 2011


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



More information about the TYPO3-english mailing list