Forum

Thread tagged as: Question, Problem, Docs
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, last_item is there, but empty. Are you 100% sure that this returns your menu item?

perch_content_custom('title', array(
    'page'=>'/portfolio.php'
));

Hi,

This is pulling a title "Cig Gafr Conwy " and I want it to display in the end of the breadcrumb.

https://fineline-new.fineline-websolutions.co.uk/casestudy/cig-gafr-conwy

Once i get it to output i will create a new template just for this breadcrumb template.

Regards Alex

Good morning,

Any update on why i cannot output a simple region from another page?

Drew McLellan

Drew McLellan 2638 points
Perch Support

So you've confirmed that this does actually output what you want, yes?

Yes, as i have already said. It is a title of the portfolio item, reading "Cig Gafr Conwy"

Its outputs in two areas, the 'Client' on the right side and the actual name of the portfolio item.

Regards

Drew McLellan

Drew McLellan 2638 points
Perch Support

What does this output?

$title = perch_content_custom('title', array(
    'page'=>'/portfolio.php'
), true);
echo $title;

Nothing at all, :(

Drew McLellan

Drew McLellan 2638 points
Perch Support

But this outputs your title?

perch_content_custom('title', array(
    'page'=>'/portfolio.php'
));

I'm struggling to see how one would work and the other not.

Hi Drew,

Please see this video.

https://screencast.com/t/jLcROoNgvdk

Does this make sense?

Regards

Hi,

Did my video make any sense?

Drew McLellan

Drew McLellan 2638 points
Perch Support

What is the name of the region that uses portfolio_item.html, and how are you displaying it? From your video, it doesn't look like title is a region - it looks like a field within a region.

Drew McLellan said:

What is the name of the region that uses portfolio_item.html, and how are you displaying it. From your video, it doesn't look like title is a region - it looks like a field within a region.

Drew,

I have followed your own guide into adding portfolio items

https://docs.grabaperch.com/video/v/portfolio-with-categories/

The region is portfolio with multiple items set so i can add many portfolio clients.

Regards

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's really hard to help without you answering the questions I'm asking. All I'm trying to do is figure out where you're going wrong - it's not for my benefit, I'm trying to help you. Please help me to help you.

What is the name of the region that uses portfolio_item.html, and how are you displaying it?

Hi Drew,

So sorry Drew!

The name of the region is portfolio and it is displayed as follows

<!-- portfolio items -->
    <div class="page-header">
            <div class="uk-container uk-container-center">
            <div class="uk-grid uk-flex uk-flex-middle uk-margin-top uk-margin-bottom">
            <div class="uk-width-medium-1-2">
                <h2><?php perch_pages_title(); ?></h2>
            </div>
                <div class="uk-width-1-2 uk-float-right"><?php
$title = perch_content_custom('title', array(
    'page'=>'/portfolio.php'
), true);
echo $title;
perch_pages_breadcrumbs(); ?></div>
            </div>
            </div>
        </div>
    <div class="uk-container uk-container-center uk-margin-top uk-margin-bottom">
        <div class="uk-grid uk-margin-bottom uk-margin-top" data-uk-grid-margin>
            <div class="uk-width-medium-1-1 uk-flex-middle">
                <?php
    perch_content_create('Portfolio', array(
      'template'   => 'portfolio_item.html',
      'multiple'    => true,
      'edit-mode' => 'listdetail',
    ));
    ?>
    <?php
    perch_content_custom('Portfolio', array(
      'template' => 'portfolio_listing.html',
    ));
    ?>
            </div>

        </div>
    </div>
    <!-- portfolio items end -->
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. So this is nonsense and doesn't display anything, right? Because there's no region called title. Your region is called Portfolio.

perch_content_custom('title', array(
    'page'=>'/portfolio.php'
));

Instead, create new template called portfolio_item_title.html and put this in it:

<perch:content id="title" type="text" />

Then to display the title, you need to start with something like this:

perch_content_custom('Portfolio', array(
      'template' => 'portfolio_item_title.html',
    ));

... but you also need to add whatever filter you're using to pick a single item. What does the code on your detail page look like?

Drew,

The title is in portfolio_item.html, that is what I want to display on the breadcrumb. Why can i can just pass this field into the breadcrumb?

SINGLE ITEM: Notice the title - <perch:content id="title" type="text" label="Client Name" required="true" order="1" title="true" />

<div class="uk-grid uk-flex uk-flex-middle uk-margin-bottom uk-margin-top" data-uk-grid-margin>
    <div class="uk-width-medium-1-1 uk-flex-middle">
        <div class="uk-slidenav-position" data-uk-slideshow="{autoplay:true,autoplayInterval:4000,autoplay:true}">
            <perch:before>
                <ul class="uk-slideshow uk-grid uk-grid-width-1-3">
            </perch:before>
            <perch:repeater id="gallery" label="Portfolio Slider Images" order="6">
                <li>
                    <img src="<perch:content type="image" id="image" label="Portfolio Image" order="1" />" alt="<perch:content type=" text" id="alt" label="image alt text (SEO)" order="2" />" />
                </li>
                <perch:after>
                    </ul>
                </perch:after>
            </perch:repeater>
            <a href="" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous" data-uk-slideshow-item="previous"></a>
            <a href="" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next" data-uk-slideshow-item="next"></a>
            <ul class="uk-dotnav uk-dotnav-contrast uk-flex-center uk-margin-top">
            <perch:repeater id="gallery">
    <li data-uk-slideshow-item="<perch:content id="perch_item_zero_index" type="hidden" />">
        <a href=""></a>
    </li>
    </perch:repeater>
</ul>
        </div>
    </div>
    </div>
    <div class="uk-width-1-">
        <div class="uk-grid uk-grid-divider">
            <div class="uk-width-medium-2-3">
                <h1 class="uk-margin-remove">
                <perch:content id="title" type="text" label="Client Name" required="true" order="1" title="true" />
                </h1>
                                <p><perch:content id="desc" type="textarea" label="Project Overview" textile="false" markdown="true" editor="markitup" order="4" divider-before="Client Overview" /></p>
                            </div>
                            <div class="uk-width-medium-1-3">
                                <ul class="uk-list uk-list-line uk-list-space">
                                    <li><div class="uk-float-left">Client</div><div class="uk-float-right"><perch:content id="title" type="text" label="Client Name" required="true" order="1" title="true" divider-before="Information Block" /></div></li>
                                    <li><div class="uk-float-left">Project by</div><div class="uk-float-right"><perch:content id="completeby" type="text" label="Complete by" required="true" order="4" /></div></li>
                                    <li>
                                    <div class="uk-grid">
                                        <div class="uk-width-1-3 uk-float-left">
                                            <div class="uk-float-left">Deliverables</div>
                                        </div>
                                        <div class="uk-width-2-3 uk-text-right">
                                            <perch:repeater id="deliverables" label="Deliverables">
                                                    <perch:before>
                                                        <ul>
                                                </perch:before>
                                                     <li class="">
                                                         <perch:content id="deliverables" type="select" label="Deliverables" options="Brand Identity,Publishing,Web Design, Corporate Stationery" allowempty="false" required="true" />
                                                     </li>
                                                 <perch:after>
                                                    </ul>
                                                </perch:after>
                                             </perch:repeater>
                                        </div>
                                    </div>
                                    <li><div class="uk-float-left">Share</div>
                                    <div class="uk-float-right">
                                    <div class="fb-share-button" data-href="/casestudy/<perch:content id="slug" type="slug" for="title" />" data-layout="button"></div>
                        <a class="twitter-share-button" href="https://twitter.com/share">Tweet</a>
                        <div class="g-plus" data-action="share" data-annotation="none" data-href="/casestudy/<perch:content id="slug" type="slug" for="title" />"></div>
                        <a href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark"  data-pin-color="red"><img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a>
                        </div></li>
                                </ul>
                                <perch:content id="listimage" type="image" label="Portfolio Image Thumbnail" width="548" height="200" crop="true" suppress="true" order="4" />
                                <perch:content id="slug" type="slug" for="title" suppress="true" />
                                <h3>Services Provided</h3>
                                <ul class="uk-grid uk-grid-width-1-5 uk-grid-small" data-uk-grid-margin="">
                                <perch:repeater id="servicesprovidedlist">
                                <li class="">
                                <img src="../../images/portfolio/service-icons/<perch:content type="select" id="servicesprovidedicon" label="Services Provided" options="Design|design,Web|web" />.png" width="51" height="44" alt="service icon" />
                                </li>
                                </perch:repeater>
                                </ul>
            </div>
        </div>
    </div>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, that's your template. What about the code on your page for showing a single item? (The 'detail' view)

Hi Drew,

Code below for this page: https://fineline-new.fineline-websolutions.co.uk/portfolio/

You will see the title is also here :)

<perch:before>
<ul class="uk-grid uk-grid-width-1-2" data-uk-grid-margin>
</perch:before>
    <li>
        <figure class="uk-overlay uk-overlay-hover">
    <img src="<perch:content id="listimage" type="image" label="image" width="376" height="200" crop="true" />" >
    <figcaption class="uk-overlay-panel uk-overlay-slide-bottom uk-overlay-background uk-flex uk-flex-center uk-flex-middle uk-text-center"><div>
        <h2>
            <perch:content id="title" type="text" label="Title" required="true" title="true"  order="5" />
        </h2>
        <p>
            <a class="uk-button dark" href="/casestudy/<perch:content id="slug" type="slug" for="title" />">View Case Study</a>
        </p>
    </div></figcaption>
</figure>
        <perch:content id="title" type="text" label="Title" required="true" title="true" suppress="true" order="5" />

    </li>
    <perch:after>
</ul>
</perch:after>
Drew McLellan

Drew McLellan 2638 points
Perch Support

What about the code on your page for showing a single item? (The 'detail' view)

Hi Drew,

I have already posted that up

Code below for page: https://fineline-new.fineline-websolutions.co.uk/casestudy/cig-gafr-conwy

<div class="uk-grid uk-flex uk-flex-middle uk-margin-bottom uk-margin-top" data-uk-grid-margin>
    <div class="uk-width-medium-1-1 uk-flex-middle">
        <div class="uk-slidenav-position" data-uk-slideshow="{autoplay:true,autoplayInterval:4000,autoplay:true}">
            <perch:before>
                <ul class="uk-slideshow uk-grid uk-grid-width-1-3">
            </perch:before>
            <perch:repeater id="gallery" label="Portfolio Slider Images" order="6">
                <li>
                    <img src="<perch:content type="image" id="image" label="Portfolio Image" order="1" />" alt="<perch:content type=" text" id="alt" label="image alt text (SEO)" order="2" />" />
                </li>
                <perch:after>
                    </ul>
                </perch:after>
            </perch:repeater>
            <a href="" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous" data-uk-slideshow-item="previous"></a>
            <a href="" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next" data-uk-slideshow-item="next"></a>
            <ul class="uk-dotnav uk-dotnav-contrast uk-flex-center uk-margin-top">
            <perch:repeater id="gallery">
    <li data-uk-slideshow-item="<perch:content id="perch_item_zero_index" type="hidden" />">
        <a href=""></a>
    </li>
    </perch:repeater>
</ul>
        </div>
    </div>
    </div>
    <div class="uk-width-1-">
        <div class="uk-grid uk-grid-divider">
            <div class="uk-width-medium-2-3">
                <h1 class="uk-margin-remove">
                <perch:content id="title" type="text" label="Client Name" required="true" order="1" title="true" />
                </h1>
                                <p><perch:content id="desc" type="textarea" label="Project Overview" textile="false" markdown="true" editor="markitup" order="4" divider-before="Client Overview" /></p>
                            </div>
                            <div class="uk-width-medium-1-3">
                                <ul class="uk-list uk-list-line uk-list-space">
                                    <li><div class="uk-float-left">Client</div><div class="uk-float-right"><perch:content id="title" type="text" label="Client Name" required="true" order="1" title="true" divider-before="Information Block" /></div></li>
                                    <li><div class="uk-float-left">Project by</div><div class="uk-float-right"><perch:content id="completeby" type="text" label="Complete by" required="true" order="4" /></div></li>
                                    <li>
                                    <div class="uk-grid">
                                        <div class="uk-width-1-3 uk-float-left">
                                            <div class="uk-float-left">Deliverables</div>
                                        </div>
                                        <div class="uk-width-2-3 uk-text-right">
                                            <perch:repeater id="deliverables" label="Deliverables">
                                                    <perch:before>
                                                        <ul>
                                                </perch:before>
                                                     <li class="">
                                                         <perch:content id="deliverables" type="select" label="Deliverables" options="Brand Identity,Publishing,Web Design, e-Commerce, Corporate Stationery, Prospectus, Yearbooks, Multimedia Replication, Printing, Illustration, Animation" allowempty="false" required="true" />
                                                     </li>
                                                 <perch:after>
                                                    </ul>
                                                </perch:after>
                                             </perch:repeater>
                                        </div>
                                    </div>
                                    <li><div class="uk-float-left">Share</div>
                                    <div class="uk-float-right">
                                    <div class="fb-share-button" data-href="/casestudy/<perch:content id="slug" type="slug" for="title" />" data-layout="button"></div>
                        <a class="twitter-share-button" href="https://twitter.com/share">Tweet</a>
                        <div class="g-plus" data-action="share" data-annotation="none" data-href="/casestudy/<perch:content id="slug" type="slug" for="title" />"></div>
                        <a href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark"  data-pin-color="red"><img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a>
                        </div></li>
                                </ul>
                                <perch:content id="listimage" type="image" label="Portfolio Image Thumbnail" width="548" height="200" crop="true" suppress="true" order="4" />
                                <perch:content id="slug" type="slug" for="title" suppress="true" />
                                <h3>Services Provided</h3>
                                <ul class="uk-grid uk-grid-width-1-5 uk-grid-small" data-uk-grid-margin="">
                                <perch:repeater id="servicesprovidedlist">
                                <li class="">
                                <img src="../../images/portfolio/service-icons/<perch:content type="select" id="servicesprovidedicon" label="Services Provided" options="Design|design,Web|web,Display|display,Print|print" />.png" width="51" height="44" alt="service icon" />
                                </li>
                                </perch:repeater>
                                </ul>
            </div>
        </div>
    </div>