Acces the raw wiki page contents in a Dokuwiki Render Plugin - php

I created a plugin and its basic functionalities are working well. It returns always testing as you can see in the method document_end().
But how can I access the plain, raw wiki page content?
This is my rawcontent.php file in the corresponding plugin folder.

I got it. After a deep serach in the code of Dokuwiki I discovered rawWiki().
It returns the raw content of a page, the current page name/id is a "global" "constant" named $ID.
Solution:
global $ID;
return rawWiki($ID);

Related

Am I using Wordpress incorrectly?

I am new to web dev with WP. I just realized that I made my front page (it has a form to be filled out by a user) by putting the code for it in a php file (through CPanel) and using <?php include() ?> to use that php file in my index.php. However, I just noticed that WP has a Pages section where I can add code by simply surrounding it with <code></code>. What is the best practice here? Am I under-using the CMS that is Wordpress by not using this Pages section? Or is it ok to not use it?
you can use some pulgins to use php code in pages like "allow-php-in-posts-and-pages" . and if you want some php file then you have create a template for that and that temmplate should be add in wp-page .

Why can I see the variable in the URL but the variable contains NULL when using GET

I am using a WordPress child theme and a custom page template. A separate folder in the child theme directory connects to an external database outside of this WordPress install. All database connections are good!
I am having a problem reading a 'test' variable passed from a link to another PHP page. Both pages exist in WordPress but each page are using a different page template - passing a variable between page templates!!
The HTML and PHP code from the first template (Wordpress Page) sends on link click to the other
View Photos
The destination URL reads: websiteurl.co.uk/?page_id=93?test=162
To see if the variable is being passed correctly before continuing I dumped the variable, however the variable contents displayed NULL
<?php var_dump(count($_GET['test'])); var_dump($_GET['test']); ?>
I have also tried
<?php var_dump(count($_POST['test'])); var_dump($_POST['test']); ?>
But the output is
int(0) NULL
Why can I see the variable in the URL but the variable contains NULL when using GET? All research seems to suggest this should be fine, or is it the way WordPress handles the URL?
Hope someone can point me in the right direction!
Thanks in advance
Your URL needs to be as
websiteurl.co.uk/?page_id=93&test=162

Wordpress Get URL Footer File

I need to access the footer inside a wordpress theme via a url. Ideally it would just render the footer data and nothing else, alternative suggestions welcomed though.
To add some context, the data will be fetched through the url and a script will read the markup. This data will then be cached and available through Magento where it is needed to be displayed..
Is there a url path that will display it or should I make a new page that can be called via the base-url+the-page-name???
There's nothing built in to do that. You could use the AJAX API in your theme or a plugin and accomplish it.
You hook into an action that gets sent as a URL or POST data parameter and then make a request to yoursite.com/path/to/wordpress/wp-admin/admin-ajax.php.
<?php
add_action('wp_ajax_so20495429_display_footer', 'so20495429_display_footer');
add_action('wp_ajax_nopriv_so20495429_display_footer', 'so20495429_display_footer');
function so20495429_display_footer()
{
get_footer('ajax');
}
This will work for all users, logged in or not, despite the wp-admin URL. Here is code above wrapped up in a plugin.
what you can do is make a wordpress custom page template.
If you dont know how heres a little tutorial : http://www.expand2web.com/blog/custom-page-template-wordpress/
Now you want the custom page template to only load the footer (add the html, head and body opening tags yourself)
if you create a new page with your page template seletced it will only output the footer.
Hope you can get it to work
Greetings
merijn
What about $footer_url=get_template_directory_uri().'/footer.php'; ?

Wordpress calling an HTML file from PHP

I am trying to modify a theme on wordpress. The theme shows a slider on the front page, which reads from the featured.php file.
I have gone into the featured.php and removed all the PHP code. I can inject my custom HTML into the featured.php and the pages display properly, however I want the page to display from a wordpress page.
So i tried to:
<?php
$html = file_get_contents('http://www.mydomain.com/homepage-featured');
?>
The above link corresponds to a page i created in wordpress. So i want to be able to inject my HTML into that page and then when you load my homepage, the PHP tells the browser to display the contents of this URL.
The above code doesn't work.
Thanks for the help.
file_get_contents() - as its name suggests - reads a file in but does not print it. You need to echo your $html variable. A better way is to use require() or include() but if I were you I would put my custom file on the same server so that way you don't have to use the file from a remote location thus sparing network traffic.
I think you have better to use the include function.
The file_get_contents you are using would generate an HTTP request, so it would make your script slower. I think it would be a good idea to put the HTML file on the same server if possible.
Have you tried
<?php
require('http://www.mydomain.com/homepage-featured');
?>
If my understanding is correct, you are trying to use a template (featured.php) for a different page other than the front page.
To do so, just change the Page Template of the page(the separate page which is # www.url.com/myhomepage). You can change this # Dashboard > Pages (Click Edit link in the required page) > Edit Page > Page Attributes meta box (available in the rightside below Publish) > Template. Change the template of this page to "Featured".
(I assume that your code in file feature.php has Template Name: Featured at the top)

Drupal Content Image URI

I'm trying to theme a view in Drupal 7. I have the view theme set-up and it is working fine. The issue that I have is that I can't see a way to override the $content variable passed into the render() function.
Is there a pre/process hook that I should be using or should it be done in a .tpl file using the $node variable?
Currently I'm looking at the $node variable but the image attached to the content has a url of public://field/image/imagefield_JmDqqm.jpg and I've not been able to find a function (so far) that will parse that url into the correct url to view the image on the page.
Thanks for any and all help.
The file_create_url function is what you're after

Categories