Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Oil ceates full ULRs instead of partials
  • Hello,

    I am just making my own scaffolding templates whch really is working good. Only one small problem I have:

    <a class="btn btn-info" href="<?php echo $uri; ?>/edit/<?php echo '<?php'; ?> echo $<?php echo $singular_name; ?>->id; <?php echo '?>'; ?>">
                                    <i class="icon-edit icon-white"></i> 
                                </a>
    creates:
    <a class="btn btn-info" href="animal/edit/<?php echo $animal->id; ?>">
                                    <i class="icon-edit icon-white"></i> 
                                </a>
    which is perfect.

    But
    <?php echo Form::open($uri.'/delete/'.'<?php echo $singular_name->id; ?>'); ?><?php echo "\n" ?>
    creates
    <form action="http://playground.local/animal/delete/<?php echo $singular_name->id; ?>" accept-charset="utf-8" method="post">
    with a full URL. Is there anyway that this will also be only
    action="animal/delete/<?php echo $singular_name->id; ?>"

    That would be perfect as I then can change Base:URL without doing all modules new with Oil.

    I use $uri in both areas and I don't understand why one time it creates a full URL and in one time not.

    Thanks for your help
    Kay
  • I don't know exactly where these snippets come from, and why $uri contains a fully qualified URI in the second case.

    But I assume it's a URI created with Uri::create(), which uses the base_url defined in your config file. If that is set to null, Fuel will autodetect the base url, which is always a fully qualified result.

    Try setting the base_url in the config to "" (empty string) or "/" (relative path).
  • I just start always with a / before $uri and now everything is working perfectly.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion