Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Normal
There's a number of edge cases that can profit from this, such as iterating over content ids without actually having verified that the content ID exists. You can do this if you know a maximum ID, but don't want to look up all intermediate IDs and don't explicitly want to care if there's any holes in your ID list, or even to simplify fetching all existing IDs to just fetching the maximum ID and then just iterating over all.Basic example:[CODE="php"]$viewableIds = [];for($i = 0; $i <= $maxContentId; $i++) { $viewableIds[] = \XF::visitor()->hasContentPermission($contentType, $i, 'view');}// Proceed to fetch content with these IDs, or store IDs in cache for later fetching[/CODE]
There's a number of edge cases that can profit from this, such as iterating over content ids without actually having verified that the content ID exists. You can do this if you know a maximum ID, but don't want to look up all intermediate IDs and don't explicitly want to care if there's any holes in your ID list, or even to simplify fetching all existing IDs to just fetching the maximum ID and then just iterating over all.
Basic example:
[CODE="php"]
$viewableIds = [];
for($i = 0; $i <= $maxContentId; $i++) {
$viewableIds[] = \XF::visitor()->hasContentPermission($contentType, $i, 'view');
}
// Proceed to fetch content with these IDs, or store IDs in cache for later fetching[/CODE]
We use essential cookies to make this site work, and optional cookies to enhance your experience.
See further information and configure your preferences