#1 2016-06-19 13:18:27

alfianasdianto
Member
Registered: 2016-06-19
Posts: 3

I'm can't display page with id from category name

Hello, i'm have trouble i show list category and i want get data from another page with category name.
This is my code:
<ion:categories>
                <ion:page id="<ion:category:name />">
                    <ion:element:image>
                        <ion:items>
                            <ion:image>
                                <ion:medias type="picture">       
                                    <img src="<ion:media:src />" alt=""> <br>
                                </ion:medias>
                            </ion:image>
                        </ion:items>
                    </ion:element:image>
                </ion:page>
                <a href="<ion:base_url /><ion:language:code />/<ion:category:name />"><ion:category:title /></a>
            </ion:categories>

and output in page :
Missing End tag for "page"

if there is no input to solve this problem?
thank you

Offline

#2 2016-06-19 15:43:41

otemu
Member
Registered: 2014-03-07
Posts: 183

Re: I'm can't display page with id from category name

Hi,

You can't pass in an ionize tag as a attribute

  <ion:page id="<ion:category:name />">

which is probably why you receiving the Missing End tag for "page"

Offline

#3 2016-06-19 15:56:17

alfianasdianto
Member
Registered: 2016-06-19
Posts: 3

Re: I'm can't display page with id from category name

Hi Otamu, Thank you for your response.

is there a solution to this problem?
I tried to use a parameter with php variable also still can not.

this is my code with variable php :
             <?php
            $category_name = "<ion:category:name />";
            ?>
                <ion:page id="<?=$category_name?>">
                    <ion:element:image>
                        <ion:items>
                            <ion:image>
                                <ion:medias type="picture">       
                                    <img src="<ion:media:src />" alt=""> <br>
                                </ion:medias>
                            </ion:image>
                        </ion:items>
                    </ion:element:image>
                </ion:page>
                <a href="<ion:base_url /><ion:language:code />/<ion:category:name />"><ion:category:title /></a>
            </ion:categories>

see out but the process was wrong, was not as expected.
Many Thanks

Offline

#4 2016-06-21 01:54:11

otemu
Member
Registered: 2014-03-07
Posts: 183

Re: I'm can't display page with id from category name

Hi,

Sadly using php variables won't work either to pass as page id. 

Possible solutions:

You could write your own module to achieve such a thing.
Hack ionize core tag manager 'page'..... But am sure you don't want to do that
Ajax call to database that returns results

Or you could try a messy hack, but won't be maintenance friendly and your have to hard code the categories, use this code at your own risk haha, you could do something like this:

$category_name = "<ion:category:name />";

switch ($category_name) {
    case "cat1":
       <ion:page id="cat1>">
       //code
        break;
    case "cat2":
        <ion:page id="cat2>">
        //code
        break;
    case "cat3":
      <ion:page id="cat3>">
        //code
        break;
    default:
        <ion:page id="default>">
        //code
}

Last edited by otemu (2016-06-21 01:54:35)

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations