문제

I'm using hyde (http://hyde.github.io) and everything is working great. Then I needed a page that is not static. I wrote it in php. Is there a way to have hyde just copy the content straight in to the deploy page from the content page?

{% extends "topbar.j2" %}
{% block container %}
  {% block ignore %}  *Hyde don't try to process just copy as is*
     <h2> Search </h2>
     <?php
       ... php code ...
       echo "Stuff"
     ?>
  {% endblock ignore %}
{% endblock container %}
도움이 되었습니까?

해결책

So with some playing and deeper reading of the documentation.

  1. The raw tag is for jinja syntax only (as shown)

    {% raw %}
    <ul>
        {% for item in seq %}
        <li>{{ item }}</li>
        {% endfor %}
    </ul>
    {% endraw %}
    
  2. Thought about turning off the markdown filter for the search page, but didn't want to create jinja page rules

  3. Learned that one line of php does not seem to break the page.

    <?php phpinfo(); ?> 
    
  4. Our solution

    1. Move all php code back to its own file searcher.php

      <?php
        if(url is searcher.php redirect to search.php);
        //code and stuff ... ;
        echo "results";
      ?>
      
    2. Keep the search.php page simple

      {% extends "topbar.j2" %}
        {% block container %}
          <h2> Search </h2>
          {% raw %}
            <?php include_once("searcher.php"); ?>
          {% endraw %}
        {% endblock container %}
      
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top