symfony1.2でDoctrine1.1使ってJobeetチュートリアル4日目

躓いたとこをメモ

画像が見つからない

apps/frontend/templates/layout.php

を変更した後

http://jobeet.localhost/frontend_dev.php/job/new

見てもデモと違う。


厳密には、自分の場合公開ディレクトリの場所変えてるから

http://colinux/~takitake/jobeet/frontend_dev.php/job/new

こんなURLになってる。
ホームディレクトリ構造

public_html
`-- jobeet
    |-- index.php
    |-- frontend_dev.php
    |-- css -> /home/takitake/sfprojects/jobeet/web/css
    |-- images -> /home/takitake/sfprojects/jobeet/web/images
    |-- js -> /home/takitake/sfprojects/jobeet/web/js
    |-- sf -> /usr/share/pear/data/symfony/web/sf
    `-- uploads -> /home/takitake/sfprojects/jobeet/web/uploads

sfprojects
`-- jobeet


index.phpから、ディスパッチャへのパスを書き換えている

<?php
// ~/public_html/jobeet/index.php

require_once('/home/takitake/sfprojects/jobeet/config/ProjectConfiguration.class.php');

$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);
sfContext::createInstance($configuration)->dispatch();
解決方法

imageタグのsrcが直打ちだから、ヘルパー利用して解決してあげた。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>Jobeet - Your best job board</title>
    <link rel="shortcut icon" href="/favicon.ico" />
    <?php include_javascripts() ?>
    <?php include_stylesheets() ?>
  </head>
  <body>
    <div id="container">
      <div id="header">
        <div class="content">
          <h1><a href="/job">
            <!-- 変更 -->
            <?php echo image_tag('jobeet.gif', array('alt' => 'Jobeet Job Board')) ?>
          </a></h1>

          <div id="sub_header">
            <div class="post">
              <h2>Ask for people</h2>
              <div>
                <a href="/job/new">Post a Job</a>
              </div>
            </div>

            <div class="search">
              <h2>Ask for a job</h2>
              <form action="" method="get">
                <input type="text" name="keywords" id="search_keywords" />
                <input type="submit" value="search" />
                <div class="help">
                  Enter some keywords (city, country, position, ...)
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>

      <div id="content">
        <?php if ($sf_user->hasFlash('notice')): ?>
          <div class="flash_notice"><?php echo $sf_user->getFlash('notice') ?></div>
        <?php endif; ?>

        <?php if ($sf_user->hasFlash('error')): ?>
          <div class="flash_error"><?php echo $sf_user->getFlash('error') ?></div>
        <?php endif; ?>

        <div class="content">
          <?php echo $sf_content ?>
        </div>
      </div>

      <div id="footer">
        <div class="content">
          <span class="symfony">
            <!-- 変更 -->
            <?php echo image_tag('jobeet-mini.png') ?>
            powered by <a href="http://www.symfony-project.org/">
            <!-- 変更 -->
            <?php echo image_tag('symfony.gif', array('alt' => 'symfony framework')) ?></a>
          </span>
          <ul>
            <li><a href="">About Jobeet</a></li>
            <li class="feed"><a href="">Full RSS feed</a></li>
            <li><a href="">Jobeet API</a></li>
            <li class="last"><a href="">Affiliates</a></li>
          </ul>
        </div>
      </div>
    </div>
  </body>
</html>