Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Add-ons » Publisher » Categories ... documentation?

Status Resolved
Add-on / Version Publisher 1.6.2
Severity
EE Version 2.9.2

Gavin Lawrie

Apr 06, 2015

Is there anything in draft you could temporarily post?

I have entered some category translations within the Categories area of Publisher.  However this code does not pull the translated category titles, and I’m not sure why.

{exp:gwcode_categories style="linear" cat_id="{embed:category}" custom_fields="yes" depth="2" parse="inward" show_empty="no"}
     
        <div class="resource_cat_container" data-id="{cat_url_title}">
            <h2><a name="{cat_url_title}" class="no-style">{cat_name}</a></h2>
<p>...

  I’m guessing that perhaps using GWCode_categories to pull the category list is the problem, but not sure whether there is a work-around for this - as presumably the {cat_name} record being accessed is the same whether it is grabbed by GWCode or EE natively…

Any ideas?

#1

BoldMinded (Brian)

GW Code Categories does not work natively with Publisher. If you need to use it, you’ll have to call the Publisher tag inside of it to get translated values, so:

{exp:gwcode_categories style="linear" cat_id="{embed:category}" custom_fields="yes" depth="2" parse="inward" show_empty="no"}
{exp:publisher:translate_category cat_id="{cat_id}"}
 {cat_name}
 {cat_url_title}
 {cat_description}
 {cat_image}
 {cat_order}
 {cat_id}
 {site_id}
 {group_id}
 {parent_id}
 {[custom_category_field]}
{/exp:publisher:translate_category}
{/exp:gwcode_categories}
#2

Gavin Lawrie

OK - thanks. I’ll experiment. Enclosing the publisher tags within the GWCode ones as you suggest doesn’t work straight off with the site code, but I’ll put together a test page to clean out some of the other complications and see if I can get something to go.

Thanks again for your help: very very nearly done with getting this one migrated now I think 😊

#3

BoldMinded (Brian)

Don’t forget to try an embed inside of the gwcode_categories tag to see if the results are different if it doesn’t work as I noted above.

#4

Gavin Lawrie

Hi. I’ve done a test page that appears to confirm that GW Code Categories extension is not compatible with Publisher. On the test page a simple call is made for a category that has Publisher translations in English, French and Arabic. In the first return the call is nested GWCode / Publisher, in the second the call is just via publisher. On the test page the first call for the category is only displayed in English regardless of what Publisher language is chosen. In the second, it displays in the appropriate language.

http://v7a.2gc.org/en/pages/categorytest

Here is the code from the page:

{embed="partials/head" status="{status}"}

<body>
                 <div  smaller; color: black; direction: ltr; background-color: #35508e;">
                        {exp:publisher:switcher style="links"}
                 </div>
{exp:gwcode_categories style="linear" cat_id="24" custom_fields="yes" depth="2" parse="inward" show_empty="yes"}
{exp:publisher:translate_category cat_id="24"}
                    <!--                  here is the start -->
                 <div  smaller; color: black;">
                     <table>
                         <th>
                             <td colspan="2">GWCode + Publisher</td>
                            </th>
                         <tr>
                             <td >Name</td><td >{cat_name}</td>
                         </tr>
                         <tr>
                             <td>ID?</td><td> {cat_id}</td>
                            </tr>
                     </table>
                    </div>

                    <!-- here is the end -->
{/exp:publisher:translate_category}
{/exp:gwcode_categories}

{exp:publisher:translate_category cat_id="24"}
                    <!--                  here is the start -->
                 <div  smaller; color: black;">
                     <table>
                         <th>
                             <td colspan="2">Publisher only</td>
                            </th>
                         <tr>
                             <td >Name</td><td >{cat_name}</td>
                         </tr>
                         <tr>
                             <td>ID?</td><td> {cat_id}</td>
                            </tr>
                     </table>
                    </div>

                    <!-- here is the end -->
{/exp:publisher:translate_category}



</body>
</html>

Bonus question: The use of GW Code Categories on the site is quite simple - it is used in various places to pull sub-sets of a category tree for other processing (e.g. to insert sub-menu items selectively within a custom NavEE menu). Are you aware of any other extensions / methods that might offer similar category abstraction results that are compatible with Publisher?

As ever, thanks a lot for your continuing help with this.

#5

BoldMinded (Brian)

I’m not aware of other category plugins that work natively with Publisher. Did you try using an embed tag?

{exp:gwcode_categories style="linear" cat_id="24" custom_fields="yes" depth="2" parse="inward" show_empty="yes"}
{embed="translated/categories" cat_id="{cat_id}"}
{/exp:gwcode_categories}

Then put the Publisher tag inside the embed.

#6

Gavin Lawrie

Huzzah! The embed version works (have updated the test page above to include an embed example). Will set about doing something similar on the site.

Thanks hugely for the help.

Login to reply