New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP mode #210
Comments
You need to load the CSS seperately like this:
|
@CyberShadow You're on the right track. There isn't any documentation right now because it is still so not-straightforward to use, I want to make it simpler before documenting it. @techboyg5 is right, you need to declare the CSS file in your website Now, for a long overdue explanation of using HashOver in PHP mode: <?php
// Setup HashOver for use in PHP-mode, autoload class files
require ('hashover/backend/php-setup.php');
try {
// Instantiate HashOver
$hashover = new HashOver ('php');
// Set page URL to create a backend thread directory
$hashover->setup->setPageURL ('https://comments.barkdull.org/test-page.php');
// Set page title for metadata / use in APIs
$hashover->setup->setPageTitle ('HashOver 2.0 (development) Test Page');
// Do some necessary setup work before loading comment files
$hashover->initiate ();
// Load and parse primary comment files
$hashover->parsePrimary ();
// Decide which comments appear in the popular comments section
$hashover->parsePopular ();
// Sort primary comments as configured
$hashover->sortPrimary ();
// Do some final setup work before outputting HTML
$hashover->finalize ();
} catch (Exception $error) {
// Displays exceptions in HTML paragraph tag
echo HashOver\Misc::displayError ($error->getMessage ());
}
?> You should place that kind of code in a PHP file that returns HTML, but place it before any HTML output, as HashOver needs to set a few headers. The key things you're missing is using After that code is in place, you can now output the HashOver HTML wherever you want using the following code... <?php
try {
// Generate interface, form, and comment HTML
echo $hashover->displayComments ();
} catch (Exception $error) {
// Displays exceptions in HTML paragraph tag
echo HashOver\Misc::displayError ($error->getMessage ());
}
?> I am going to close this issue, but feel free to continuing asking more questions here if necessary. I hope this helps. |
Thanks, I had already figured something out two years ago. Sorry for not updating the issue. |
No problem, I'm glad you figured it out. I'm just going through and answering some issues right now, some are quite old but I don't know who is still interested in answers so I just answer them all. |
Hi, and thank you for your work on this project.
I'm trying to get PHP mode to work with the latest version from git, and running into some trouble.
First, currently there is no documentation. The only instructions I found on this subject were in the changelog. This might not be a problem if integrating Hashover in PHP mode would be simple or obvious, but I haven't found such a way.
Following the changelog instructions:
hashover-next/hashover/changelog.txt
Lines 1186 to 1202 in 7a38fd1
currently seems insufficient. It results in the error:
From looking at the source code, I inferred that the above code is missing calls to
$hashover->initiate()
and$hashover->finalize()
. Adding those, there are no more errors; however, the output looks like this:Have I missed something?
The text was updated successfully, but these errors were encountered: