Externally calling a block function
Permalink
Ladies & gentlemen,
I still am working on my first c5 project. What I have seen so far is impressive, but I am facing a little problem at the moment.
One part the the project I am working on is that users can post their own articles. A user writes an article, this article is emailed to the website administrator and, depending on the content, confirmed by clicking a link in the email.
I am not sure how to put a link into the email that calls a controller method of my block, passing an id as an argument.
When I work on views, I can just insert a link to a controller method, such as $this->action("confirmNewPost"). But how can I do this externally?
I hoped for something like
http://example.com/packages/packageName/blocks/blockName/method/par...
Thanks in advance!
kind regards,
El Júlio
I still am working on my first c5 project. What I have seen so far is impressive, but I am facing a little problem at the moment.
One part the the project I am working on is that users can post their own articles. A user writes an article, this article is emailed to the website administrator and, depending on the content, confirmed by clicking a link in the email.
I am not sure how to put a link into the email that calls a controller method of my block, passing an id as an argument.
When I work on views, I can just insert a link to a controller method, such as $this->action("confirmNewPost"). But how can I do this externally?
I hoped for something like
http://example.com/packages/packageName/blocks/blockName/method/par...
Thanks in advance!
kind regards,
El Júlio
i'd use a package tools url and tools file there since you don't need to be logged in.
If you can assume their email isn't compromised you can build a simple link that uses the encryptionHelper, and if the tools request receives an authorized request methodName('hash of the title') and a hash of the cID, and the cID is numeric and the Page::getByID(cID)->getCollectionName() == unencrypted name of the page then you can assume that you can approve the page. You can even add in uID to show who approved it.
That's just how i'd do it.
If you can assume their email isn't compromised you can build a simple link that uses the encryptionHelper, and if the tools request receives an authorized request methodName('hash of the title') and a hash of the cID, and the cID is numeric and the Page::getByID(cID)->getCollectionName() == unencrypted name of the page then you can assume that you can approve the page. You can even add in uID to show who approved it.
That's just how i'd do it.
Woohoo, this will take me some time to try it out.
Thank you!
kind regards,
Julian
Thank you!
kind regards,
Julian
Is there a reason this needs to be in a block or is that just what you tried first?