Documentation

PreparePath

string
CBlogPost::PreparePath(
 string blogUrl,
 int    postID = 0,
 string siteID = false,
 bool   is404 = true,
);

The method returns path to the blog postID with blogUrl address, relative to siteID root with included public section option (with 404 handler or without it). Non-static method.

Method parameters

ParameterDescriptionAvailable from version
blogUrl Blog URL address.
postID Blog post ID.
Optional. By default 0 - will return path to blog.
siteID Site.
Optional. By default false - the current site is sourced.
is404 Verifies whether the 404 error handler in the public section. Optional. By default true - public section for blogs works on the basis of 404 error handler.
userID Optional parameter. Value by default - 0.
groupID Optional parameter. Value by default - 0.

Returned value

Path to blog post relative to site root.

Examples of use

<?
echo '<a href="'.CBlogPost::PreparePath("admin-blog", 1).'">First post in the blog"Administrator blog"</a>';
?>


© «Bitrix24», 2001-2024