Posts by Juan

    Does the template model.html have a perch:related field to relate documents to models?

    Yes, it has. That's how I relate documents to models.

    I was trying to do it all with one template but I realised it wasn't possible, so now I'm using this in my page template.

    However, I still have one issue. I am relating as well documents to documents, using blocks

    HTML: document.html
    1. <perch:blocks label="Secciones">
    2. <perch:template path="content/_b__text.html">
    3. <perch:template path="content/_b__features.html">
    4. <perch:template path="content/_b__figure.html">
    5. <perch:template path="content/_b__symbols.html">
    6. <perch:template path="content/_b__warning.html">
    7. <perch:template path="content/_b__labels.html">
    8. <perch:template path="content/_b__document.html">
    9. </perch:blocks>
    HTML: _b__document.html
    1. <perch:block type="document" label="Documento">
    2. <perch:related id="inserted_doc" collection="Documentos" label="Documento" max="1">
    3. </perch:related>
    4. </perch:block>

    I haven't found a way to display all the content created using with the blocks for the embedded document. Is it possible? Or should the <perch:related collection="Documentos"></perch:related> be outside the blocks?

    Hi Hussein,

    Thank you for the underscore tip, already changed it but it still doesn't work.

    The related field is inside a collection. In the debug output everything seems fine, no templates missing.

    Below is the actual code I'm using (before I simplified it a bit).

    I use an HTML free template for the collection "Modelos"

    Code: model.html
    1. <perch:content id="model_name" type="text" label="Nombre del modelo" title>
    2. <!--* More fields below *-->

    Then I use another template to output the content from that collection

    Code: model_support.php
    1. perch_collection('Modelos', [
    2. 'template' => '_v__model_'.$lang.'.html',
    3. 'filter' => 'slug',
    4. 'value' => perch_get('s'),
    5. ]);
    Code: _v__model_es.html
    1. <perch:related id="tech_specs" collection="Documentos">
    2. <perch:template path="content/_v__document_es.html">
    3. </perch:related>

    "Documentos" collection behaves in the same way, using document.html to create the collection items and other templates for display

    Code: document.html
    1. <!--* More fields above *-->
    2. <perch:related id="models" label="Modelos relacionados" collection="Modelos" required></perch:related>
    3. <!--* More fields below *-->
    Code: _v__document_es.html
    1. <perch:related id="models" collection="Modelos">
    2. <p>
    3. <perch:content id="model_name" type="text"> <span><perch:content id="model_number" type="text"></span>
    4. </p>
    5. </perch:related>

    Is there a way to include a template inside a <perch:repeater> to output content?

    I' trying to do so but it is not working with the following code

    1. <perch:related id="tech-specs" collection="Documentos">
    2. <perch:template path="content/document.html">
    3. </perch:related>

    If I write directly the content from the template instead of including it with <perch:template> it does work, but that forces me to duplicate it almost entirely

    1. <perch:related id="tech-specs" collection="Documentos">
    2. <h1><perch:content id="document_name" type="text"></h1>
    3. </perch:related>

    I have this piece of code in my template:

    1. <perch:repeater id="timetable" label="Timetable">
    2. <perch:content id="start_day" type="select" label="From" options="Monday | Lunes, Tuesday | Martes, Wednesday | Miércoles, Thursday | Jueves, Friday | Viernes, Saturday | Sábado, Sunday | Domingo" required>
    3. <perch:content id="end_day" type="select" label="To" options="Monday | Lunes, Tuesday | Martes, Wednesday | Miércoles, Thursday | Jueves, Friday | Viernes, Saturday | Sábado, Sunday | Domingo" allowempty>
    4. <perch:content id="open_hours" type="text" label="Opening time" required help="Use 24h format (8:00, 22:00, etc) and separate each period with '|'">
    5. </perch:repeater>

    When I edit the content everything works fine, the values set in both selects are stored correctly. The problem is when I go back to the edit page, the first select is set to Monday and the second one is empty. If I save now, they are saved with these default values.

    This template is being imported into another one, I don’t know if it has something to do with it. Am I doing something wrong?

    Thank you in advance

    Thank you Mxkert and hus_hmd!

    I didn't realize that I could use perch_template() to output the search without the unwanted items. I'll give it a try.

    I also tried getting all the _id's that matched the search and then filter by those values when calling perch_collection(). The problem is that I only got the first match. This was the code:

    I'm performing a search using perch_content_search() and I want to avoid displaying items in a collection if isPublished is not checked. Is there any way of doing this?

    HTML: card.html
    1. // More template fields here
    2. <perch:content id="isPublished" type="checkbox" label="Published" suppress="true" />

    Hi, I think is an old bug that needs fixing (…s-not-deleting-in-perch-3). I just want to confirm that is indeed still unresolved or I'm doing something wrong.

    Diagnostics below. Thanks!!

    Thank you Drew! My posts are multi-language, so I need to search in lots of places

    This is the post template

    And the global_blocks.html template

    Is there a way the search can match against the content in all those fields?

    I'm setting up a search page and I only get results when searching words of the post titles. If I try looking for something written in other field the search outputs no results. Am I doing something wrong?

    Diegnostics below :burd1peck: