I am trying to wrap my head around creating custom Add-Ons, and without tweaking anything from the download when I implement
it throws this error
I am unsure how to fix.
I am trying to wrap my head around creating custom Add-Ons, and without tweaking anything from the download when I implement
it throws this error
I am unsure how to fix.
It sounds like that function is expecting at least one argument and you’re not passing any arguments to it.
Have you looked at the definition of that function? What does it say?
Here is what is in the runtime.php
Hi bj.lewis221
When you call my_sample_detail(), you need to pass the first argument $thingID as a minimum. Assuming you have a Thing with ID 2:
Thank you! I tried doing <?php $project_id = perch_get('s'); ?> previously and it didn't work I have since made changes and must have had something else making it not work
thank you thank you!
Hello! Me again!
I am finally starting to get my head around this! But I have run into another snag. Sorry in advance for being a pain! Just trying to learn everything perch has to offer!
I have added a my_sample_listing_custom to the runtime.php
But When I do the Function on the index.php the only thing is seems to listen to is the template
It doesn't throw and error or anything it just returns everything as it would for my_sample_listing, except it will change to the template I specify.
What am I missing?
Again, sorry for being a pain!
What does the function my_sample_listing() look like?
This is it! TYIA!
Thank you for pointing this out! Do you have any suggestions on how to fix this? I have tried multiple things and I just can't get it.
My full runtime.php is below
You can either write your own database queries (check the database API reference) or you can use PerchFactory's get_filtered_listing().
A simplified version of what your code could be:
I replaced
with
and it didn't return anything
I also tried
If you enable debug mode, what does the debug message say?
You can add marks to the debug message so it's easier to spot the relevant lines:
You can refer to first-party apps like the Blog app to see how they handle the filtered listing. Though they may include code that isn't relevant to your app.
This is the messages that comes out
and when I change to
the debug message returns this
Ok I fixed all those errors but It's still not returning anything.
Debug
Current runtime.php
get_filtered_listing() should render the template for you. So you don't need to render it inside my_sample_listing().
Take it one step at a time and iterate on your changes. You've added get_filtered_listing() and you can see the database query it's making in your debug message. I'm assuming you have some rows in the table perch3_my_sample_things.
The next step for you would be to check what get_filtered_listing() returns. You're assigning what it returns to the variable $filtered_things. Inspect what this variable holds. Is it what you expect?
This may help:
Its returning empty rows, its weird, its returning the right number 'things' just not returning whats in the tags
So I reverted back to clean my_sample files to try and locate the issue and tried to rework with your above code. And it does return items it just returns them empty.
Debug