Way to get title of page (i.e. Collection name) of page by URL path?
Permalink 1 user found helpfulI want each thumbnail to have an appropriate Alt tag with the name of the photo in it. That photo name also happens to be the name of the page on which a larger version of that photo is found. The site owner adds a URL to that photo page within the Add Thumbnail Add On.
So I know what the URL that each thumbnail points to.
Each such URL corresponds to a page on the C5 site.
If I can get the name of the photo page somehow (i.e. the Collection name of that page) from the URL, using PHP code, from within the view.php file (or inside the view override function in the controller) of my Add On I can fill in the Alt correctly for each thumbnail added.
So is there a way for me to get the Collection name based on a URL to a C5 page if I know the URL to that page?
I can have the owner fill in the Alt tag as part of the Add On of course but I am trying to automate as much as I can to alleviate them of having to provide that information themselves.
Carlos

I've been Googling and looking at how many messages on the forum here for what seems like over an hour trying to get somewhere with this and couldn't find anything that worked.
Thanks again!
Carlos
Here's what I put into my view.php...
That code returns an empty $page object.
Same thing happens if I put the above code into the view() override function inside the controller for the block. Nothing.
$image_url is definitely there and corresponds to the name of the page that I am trying to get the name of. It's a value entered by the user into my Add On and is stored in the block table.
So I am guessing the above code should work. At least with respect to getting the Page object. But it doesn't for some reason.
Anybody got any further tips?
Thanks.
Carlos
I did it that way in testing because I didn't want to have to go back and change all the thumbnail URL's being pointed to by the thumbnails once the site goes live.
Let me edit that to a local development URL and see if that changes things.
Carlos
Here is the output from echo $image_url...
http://domain.com.local/sunrise-over-the-santa-monica-mountains...
That's changing it to my local development URL.
But having it be...
http://domain.com/sunrise-over-the-santa-monica-mountains...
Doesn't work either.
"domain" in the above is just a placeholder for the real domain name which I would rather not publish yet.
Carlos
Give me just a minute and I'll report back.
Carlos
That did it guys. THANK YOU!
I had to remove the domain name.
I just assumed that "/path" was a full URL. My bad. Sorry about that.
This is one of those problems that took forever to figure out but which was super simple in the solution (with your all's extra eyes on the problem).
Thanks again!
Carlos
I can now assign the $path value to the alt attribute of the img tag for each new and different thumbnail added to a gallery page.
Sweet!
Carlos
The url that is inside $image_url is definitely a page at my local copy of the site and it is definitely reachable by browser address bar.
Carlos
Carlos