Skip to main content
deleted 2260 characters in body
Source Link

Link info: https://docs.expressionengine.com/latest/urls/url_structure.html#entries-and-other-things

The template all and the template view inside are very similar to each other only the channel display changes but for all the form is shown with the generation of the fields from the other channels but it does not work if the url also has the name of an article.

__view-layout

{layout='layouts/_html-wrapper'}
{!-- Variabili Immobili --}
{preload_replace:i_url='immobili'}
{preload_replace:i_url_view='view'}
{preload_replace:s_url='immobili'}
{preload_replace:s_url_search='search'}

{!-- embed for breadcrumb, needed to pass arguments (embeds aren't evil) --}
{layout:set name='breadcrumbs'}
    {embed='common/_breadcrumb'
        p_url='{layout:p_url}'
        p_title='{layout:p_title}'
        {if layout:entry_ch}entry_ch='{layout:entry_ch}'{/if}
    }
{/layout:set}
        
<section id="immobili">
    <div class="container">
      <div class="row">
        <div class="col-md-8">
          {layout:contents}
        </div>
        <!-- Sidebar -->
        <div class="col-md-4">
            <h1>Sidebar</h1>
            {sidebar}
        </div>
      </div>
    </div>
</section>

View Picture mysite.it/template => mysite.it/immobili the Partial Template works fine. Example

{layout='layouts/_view-layout'}

{!-- page vars --}
{preload_replace:p_title='My Blog'}
{preload_replace:p_description='Search Results'}
{preload_replace:p_url='immobili'}
{preload_replace:p_url_entry='view'}
{!-- channel vars (prefix ch_) --}
{preload_replace:ch='immobili'}
{!-- layout vars, channel/page related --}
{layout:set name='ch' value='{ch}'}
{layout:set name='p_url' value='{p_url}'}
{layout:set name='p_title' value='{p_title}'}
{layout:set name='search' value='y'}
{!-- layout vars --}
{layout:set name='title' value='search results{gv_sep}{p_title}{gv_sep}'}
{layout:set name='description' value='{p_description}'}

    {!-- require_entry makes it so if someone types the wrong URL, they will get a 404 page --}
    {exp:channel:entries channel='{ch}' limit='1' require_entry='yes'}
        {!-- layout vars, dynamic, not output --}
        {layout:set name='title' value='{title}'}
        {layout:set name='description' value='{seo_desc}'}
        {layout:set name='entry_ch' value='{ch}'}
        {!-- OpenGraph meta output --}
        {layout:set name='og_title' value='{seo_title}'}
        {layout:set name='og_url'}{path='{p_url}'}{/layout:set}
        {layout:set name='og_description' value='{seo_desc}'}
        {!-- /layout vars, dynamic, not output --}

        {!-- content output --channel="comuni"}
       <option <h1>value="{title}</h1>
        {!-- image (GRID) --}
        {if blog_image}
        {blog_image}
        <figure>
          <img src="{blog_image:image}" alt="{blog_image:caption:attr_safe}">
          <figcaption>{blog_image:captiontitle}</figcaption>
        </figure>
        {/blog_image}
        {/if}

        {blog_content}
        {!-- /content output --}

        {!-- no results redirect --}
        {if no_results}
          {redirect='404'}
        {/if}           option>
    {/exp:channel:entries}

this code works and generate the field's option.

enter image description here

Instead into picture mysite.it/template_group/template/my_url_title => mysite.it/immobili/view/villa-alessandro the Partial Template NOT works.

enter image description here

The template all and the template view inside are very similar to each other only the channel display changes but for all the form is shown with the generation of the fields from the other channels but it does not work if the url also has the name of an article.

__view-layout

{layout='layouts/_html-wrapper'}
{!-- Variabili Immobili --}
{preload_replace:i_url='immobili'}
{preload_replace:i_url_view='view'}
{preload_replace:s_url='immobili'}
{preload_replace:s_url_search='search'}

{!-- embed for breadcrumb, needed to pass arguments (embeds aren't evil) --}
{layout:set name='breadcrumbs'}
    {embed='common/_breadcrumb'
        p_url='{layout:p_url}'
        p_title='{layout:p_title}'
        {if layout:entry_ch}entry_ch='{layout:entry_ch}'{/if}
    }
{/layout:set}
        
<section id="immobili">
    <div class="container">
      <div class="row">
        <div class="col-md-8">
          {layout:contents}
        </div>
        <!-- Sidebar -->
        <div class="col-md-4">
            <h1>Sidebar</h1>
            {sidebar}
        </div>
      </div>
    </div>
</section>

View

{layout='layouts/_view-layout'}

{!-- page vars --}
{preload_replace:p_title='My Blog'}
{preload_replace:p_description='Search Results'}
{preload_replace:p_url='immobili'}
{preload_replace:p_url_entry='view'}
{!-- channel vars (prefix ch_) --}
{preload_replace:ch='immobili'}
{!-- layout vars, channel/page related --}
{layout:set name='ch' value='{ch}'}
{layout:set name='p_url' value='{p_url}'}
{layout:set name='p_title' value='{p_title}'}
{layout:set name='search' value='y'}
{!-- layout vars --}
{layout:set name='title' value='search results{gv_sep}{p_title}{gv_sep}'}
{layout:set name='description' value='{p_description}'}

    {!-- require_entry makes it so if someone types the wrong URL, they will get a 404 page --}
    {exp:channel:entries channel='{ch}' limit='1' require_entry='yes'}
        {!-- layout vars, dynamic, not output --}
        {layout:set name='title' value='{title}'}
        {layout:set name='description' value='{seo_desc}'}
        {layout:set name='entry_ch' value='{ch}'}
        {!-- OpenGraph meta output --}
        {layout:set name='og_title' value='{seo_title}'}
        {layout:set name='og_url'}{path='{p_url}'}{/layout:set}
        {layout:set name='og_description' value='{seo_desc}'}
        {!-- /layout vars, dynamic, not output --}

        {!-- content output --}
        <h1>{title}</h1>
        {!-- image (GRID) --}
        {if blog_image}
        {blog_image}
        <figure>
          <img src="{blog_image:image}" alt="{blog_image:caption:attr_safe}">
          <figcaption>{blog_image:caption}</figcaption>
        </figure>
        {/blog_image}
        {/if}

        {blog_content}
        {!-- /content output --}

        {!-- no results redirect --}
        {if no_results}
          {redirect='404'}
        {/if}           
    {/exp:channel:entries}

Link info: https://docs.expressionengine.com/latest/urls/url_structure.html#entries-and-other-things

The template all and the template view inside are very similar to each other only the channel display changes but for all the form is shown with the generation of the fields from the other channels but it does not work if the url also has the name of an article.

Picture mysite.it/template => mysite.it/immobili the Partial Template works fine. Example

{exp:channel:entries channel="comuni"}
    <option value="{title}">{title}</option>
    {/exp:channel:entries}

this code works and generate the field's option.

enter image description here

Instead into picture mysite.it/template_group/template/my_url_title => mysite.it/immobili/view/villa-alessandro the Partial Template NOT works.

enter image description here

Source Link

Channel not working in url

I can not get the fields of a channel to be fused in a form.

I created a Partial Template with the following code:

{sidebar}

<form action="{path='{s_url}/{s_url_search}'}" method="GET" id="">
<div class="form-group">
    <label>Contratto</label>
    <select class="form-control" name="contratto">
        <option value="all">Tutti i contratti</option>
        <option value="Vendita">Vendita</option>
        <option value="Affitto">Affitto</option>          
    </select>
</div>
<div class="form-group">
    <label>Comune</label>
    <select class="form-control" name="comune">
        <option value="all">Tutti i comuni</option>
        {exp:channel:entries channel="comuni"}
        <option value="{title}">{title}</option>
        {/exp:channel:entries}            
    </select>
</div>
<div class="form-group">
    <label>Tipologia</label>
    <select class="form-control" name="tipologia">
        <option value="all">Tutte le tipologie</option>
        {exp:channel:entries channel="tipologie"}
        <option value="{title}">{title}</option>
        {/exp:channel:entries}        
    </select>
</div>
<button type="submit" class="btn btn-sm btn-primary">Cerca</button>

This works if the url is of type mysite.it/Template_Group_name/Template.

It does not work instead if the url is of type mysite.it/Template_Group_name/Template/item

I give an example. I have the Blog Channel where I have the articles inside. example article: Hello Worl The code written above works if I go to mysite.it/blog/all Which shows all the articles But it does not work for mysite.it/blog/view/hello_world showing the article

The template all and the template view inside are very similar to each other only the channel display changes but for all the form is shown with the generation of the fields from the other channels but it does not work if the url also has the name of an article.

What is wrong? I also copy the view channel code.

__view-layout

{layout='layouts/_html-wrapper'}
{!-- Variabili Immobili --}
{preload_replace:i_url='immobili'}
{preload_replace:i_url_view='view'}
{preload_replace:s_url='immobili'}
{preload_replace:s_url_search='search'}

{!-- embed for breadcrumb, needed to pass arguments (embeds aren't evil) --}
{layout:set name='breadcrumbs'}
    {embed='common/_breadcrumb'
        p_url='{layout:p_url}'
        p_title='{layout:p_title}'
        {if layout:entry_ch}entry_ch='{layout:entry_ch}'{/if}
    }
{/layout:set}
        
<section id="immobili">
    <div class="container">
      <div class="row">
        <div class="col-md-8">
          {layout:contents}
        </div>
        <!-- Sidebar -->
        <div class="col-md-4">
            <h1>Sidebar</h1>
            {sidebar}
        </div>
      </div>
    </div>
</section>

View

{layout='layouts/_view-layout'}

{!-- page vars --}
{preload_replace:p_title='My Blog'}
{preload_replace:p_description='Search Results'}
{preload_replace:p_url='immobili'}
{preload_replace:p_url_entry='view'}
{!-- channel vars (prefix ch_) --}
{preload_replace:ch='immobili'}
{!-- layout vars, channel/page related --}
{layout:set name='ch' value='{ch}'}
{layout:set name='p_url' value='{p_url}'}
{layout:set name='p_title' value='{p_title}'}
{layout:set name='search' value='y'}
{!-- layout vars --}
{layout:set name='title' value='search results{gv_sep}{p_title}{gv_sep}'}
{layout:set name='description' value='{p_description}'}

    {!-- require_entry makes it so if someone types the wrong URL, they will get a 404 page --}
    {exp:channel:entries channel='{ch}' limit='1' require_entry='yes'}
        {!-- layout vars, dynamic, not output --}
        {layout:set name='title' value='{title}'}
        {layout:set name='description' value='{seo_desc}'}
        {layout:set name='entry_ch' value='{ch}'}
        {!-- OpenGraph meta output --}
        {layout:set name='og_title' value='{seo_title}'}
        {layout:set name='og_url'}{path='{p_url}'}{/layout:set}
        {layout:set name='og_description' value='{seo_desc}'}
        {!-- /layout vars, dynamic, not output --}

        {!-- content output --}
        <h1>{title}</h1>
        {!-- image (GRID) --}
        {if blog_image}
        {blog_image}
        <figure>
          <img src="{blog_image:image}" alt="{blog_image:caption:attr_safe}">
          <figcaption>{blog_image:caption}</figcaption>
        </figure>
        {/blog_image}
        {/if}

        {blog_content}
        {!-- /content output --}

        {!-- no results redirect --}
        {if no_results}
          {redirect='404'}
        {/if}           
    {/exp:channel:entries}