GiovanniSalmeri / yellow-burger

Hamburger menu.
GNU General Public License v2.0
0 stars 0 forks source link

burger.svg is not found / wrong path #1

Open Silber-Toaster opened 1 month ago

Silber-Toaster commented 1 month ago

Hello,

many thanks for the good work, I was looking for something like this.

There is a small problem on my web server. If the burger.svg remains in the source directory, it is only displayed on the "home" page, on all other pages the burger.svg is not found.

If the burger.svg is in the root directory and the source code is extended with a "/burger.svg" there are no problems.

<?php list($name, $pages, $level) = $this->yellow->getLayoutArguments() ?>
<?php if (!$pages) $pages = $this->yellow->content->top() ?>
<?php $this->yellow->page->setLastModified($pages->getModified()) ?>
<?php if (!$level): ?>
<?php $extensionLocation =  $this->yellow->system->get("coreServerBase").$this->yellow->system->get("coreExtensionLocation"); ?>
<a id="navigation-menu" href=""><img src="<?php echo $extensionLocation. '/burger.svg'; ?>" alt="<?php echo $this->yellow->language->getTextHtml("burgerMenu") ?>"></a>
<nav id="navigation-tree" data-sitename="<?php echo $this->yellow->system->getHtml('sitename') ?>">
<?php endif ?>
<ul>
<?php foreach ($pages as $page): ?>
<?php $children = $page->getChildren() ?>
<li>
<?php if ($page->get("layout") == "transit"): ?>
<span><?php echo $page->getHtml("titleNavigation") ?></span>
<?php else: ?>
<a<?php echo $page->isActive() ? " class=\"active\" aria-current=\"page\"" : "" ?> href="<?php echo $page->getLocation(true) ?>"><?php echo $page->getHtml("titleNavigation") ?></a>
<?php endif ?>
<?php if ($children->count()) { echo "\n"; $this->yellow->layout($name, $children, $level+1); } ?></li>
<?php endforeach ?>
</ul>
<?php if (!$level): ?>
</nav>
<div class="navigation-banner"></div>
<?php endif ?>

Screenshot 2024-07-13 215737

Greetings Silver

markseuffert commented 1 month ago

You don't have to put the burger.svg is in the root directory. Direct access to the system folder is not allowed, so that's why the core maps assets via a virtual location. You can access them from there, if you like, I think this is the easiest way. Of course nothing stops you from putting your images where you want.

Try replacing...

$this->yellow->system->get("coreServerBase").$this->yellow->system->get("coreExtensionLocation");

with

$this->yellow->system->get("coreServerBase").$this->yellow->system->get("coreAssetLocation");

Hope this helps.