Jump to content

Recommended Posts

Posted

I have a site that I am porting to another language.

I therefore export the profile and install the new site on a directory off-root on the new location /procws

From there I can translate and when ready upload it to root

Now here's the trouble: while working in a directory /procws I can not get the logo and some other images to show and it has to do with the template

This is what I have:

<html><head>
    <title><?=$page->{'alt_title|title'}?></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="<?=$page->meta_description; ?>" />
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
    <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <link rel="stylesheet" href="<?php echo AIOM::CSS(array('bbp/css/kickstart.css', 'bbp/style.css')); ?>">
    <script src="<?php echo AIOM::JS(array('bbp/js/prettify.js', 'bbp/js/kickstart.js')); ?>"></script>
</head><body>

<div class="grid">
    <div id="wrap" class="clearfix">

        <header class="col_12">
            <div class="col_4"><a href="/"><img src="/site/templates/bbp/img/logo.jpg" alt="Home" width="282" height="78" /></a></div>

stylesheets work ok, but this does not:

<img src="/site/templates/bbp/img/logo.jpg" alt="Home" width="282" height="78" />

What should I use there so processwire shows the logo regardless where processwire is installed, just takes it from that installation folder.

Thanks!

Posted

The URL to the template directory is stored in $config:

<img src="{$config->urls->templates}bbp/img/logo.jpg" alt="Home" width="282" height="78" />

Equally, using $config->urls->root as the base for any local resources residing outside the templates directory makes them path-agnostic as well.

  • Like 2
Posted

Thanks BitPoet, that did not work yet.

I tried different things and this one did work:

<img src="<?php echo $config->urls->templates->url ?>site/templates/bbp/img/logo.jpg" alt="Home" width="282" height="78" />
Posted

But once I go down from the root of this site down one or two directories like: /procws/directory I lose the image again, now it geos relative to this directory again...

Any ideas?


OK this one works: 

<?php echo $config->urls->root ?>

But now the images on the page itself while inserted in the article, do not show up...

Posted

Sorry, just copy&pasted from my code, so I used {} instead of php tags as the snippet I copied from was within a PHP echo().

<?php echo $config->urls->templates; ?>bbp/img/logo.jpg

should always point at the same logo at "[YOUR PW DIRECTORY]/site/templates/bbp/img/logo.jpg". Basically, it shouldn't matter if you're using $config->urls->root or $config->urls->templates, the latter is just a little shorter and more "speaking".

I'm not completely following what you mean with "on the page itself while inserted in the article". Can you give an example?

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...