This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi all,
I'm new to October and Laravel. According to Pages, I should be able to retrieve a url parameter and then reference that variable. However, while I can see that the variable does have a value using echo
on my page, it's not being set in the plug-in. The plug-in in question is here. An example url in this case is http://localhost:8888/laravel_photo/gallery?collection=TEST_GALLERY_2
title = "GALLERY"
url = "/gallery"
layout = "default"
[Gallery]
idGallery = ":my_album"
markup = "user"
slug = "{{ :slug }}"
==
<?
function onStart()
{
$my_album = strtolower($_GET['collection']);
}
?>
==
<div class="wrapper">
<h3>{{gallery.name}}</h3>
<div class="cp-sidebar-content gallery">
<ul>
{% for image in gallery.images %}
<li>
<img title="{{image.title}}" alt="{{image.description}}" src="{{ image.path }}"></a>
</li>
{% endfor %}
</ul>
</div>
</div>
I've also tried idGallery = "{{ :my_album }}".
Thanks!
Last updated
Just try this:
title = "GALLERY"
url = "/gallery/:slug"
layout = "default"
[Gallery]
markup = "user"
slug = "{{ :slug }}"
==
<div class="wrapper">
<h3>{{gallery.name}}</h3>
<div class="cp-sidebar-content gallery">
<ul>
{% for image in gallery.images %}
<li>
<img title="{{image.title}}" alt="{{image.description}}" src="{{ image.path }}"></a>
</li>
{% endfor %}
</ul>
</div>
</div>
If you call http://localhost:8888/laravel_photo/gallery/TEST_GALLERY_2
, ":slug" should get replaced with "TEST_GALLERY_2".
Note: you should provide idGallery
OR slug
to the Gallery component, noth both.
thanks @mjauvin for this! This does make sense to me; however, it doesn't seem that TEST_GALLERY_2
for instance is being interpreted as the slug. Is there configuration (i.e. callback functions, etc) I need to do for the slug to be parseable from the url? When I try to display the slug, it's empty, so it appears it is not being set.
It's worth noting that if I hardcode idGallery=test_gallery_2
I get the desired response but slug=test_gallery_2
doesn't output anything. Also, the slugs are the same as the gallery names in my case so there's nothing sneaky there.
The example I'm using is this:
title = "GALLERY"
url = "/test/:slug"
layout = ""
[Gallery]
markup = "user"
slug = "{{ :slug }}"
==
<body>
<h1> {{ slug }}</h1>
<div class="wrapper">
<h3>{{gallery.name}}</h3>
<div class="cp-sidebar-content gallery">
<ul>
{% for image in gallery.images %}
<li>
<img title="{{image.title}}" alt="{{image.description}}" src="{{ image.path }}"></a>
</li>
{% endfor %}
</ul>
</div>
</div>
</body>
Cheers!
HAHA I stared a little too hard right past that one. Easy. Thanks again. Got it working as desired.
1-6 of 6