PHP on page (9 posts)

  1. gigaset
    Posted 9 years ago #

    hey, how could I add some php code onto a specific page? I've tried to open an html-editor but additing a php code there do nothing.

    Here's my problem: i want to add php code for showing the future events that i 've added. I use calendar v 3.0
    so I create a page than i add a php-code and nothing happend....
    can you help me?

  2. moshu
    Posted 9 years ago #

    No, you cannot add php code into the content area (aka Write Page).
    You can do 2 things:
    create a Page template and put the code there, then create a new Page by using that template
    or, use a plugin that allows you to run PHP in the content.
    Search for runphp, phpexec, execphp and stuff like that.

  3. gigaset
    Posted 9 years ago #

    thank you, moshu :)

  4. nely
    Posted 9 years ago #

    2 moshu
    could you explain in details what sould i do?
    i undertand that i must create a template. done.
    and what should i do next? how could i create a new Page by using that template??

  5. estjohn
    Posted 9 years ago #

    add the php code into that template under the title of the page, then create a new page and use that for the template.

    for example:
    I used a template of page.php called it plugin.php

    under title i added the php code i wanted to use


    <h2><?php the_title(); ?></h2>
    <div id="plugins">

    <?php displayPluginsAsList(); ?>


    saved it, then created a new page, left it blank and published it.

    the result is:


  6. nely
    Posted 9 years ago #

    thanks...but i didn't understand...
    look, I wan't to use different from the whole template in my "myGallery". I'd like to create a template page for my gallery that would differ from the template i have for my web-site, i don't want to display some elements of design, for example heading. how could i perform my task? could i create just once a template and then use it several thousand times to add pages to my gallery using the tempalate different from the site-design? sorry for my english and non-concrete question, but i can't explain in another words...

  7. estjohn
    Posted 9 years ago #

    that is exactly what you do. you create the template you want to use. you save that as a template page in your themes directory. then, when you make a pages, you use the new theme

  8. oncidium
    Posted 9 years ago #

    I'm trying to do something similar...include a gallery within a page. I got the php to run on the page, see here: http://www.divaknitting.com/blog/?page_id=334 but the problem comes when you try to click on a category. I got the page to show up by putting view.php in the blog directory but now I am at a loss as to how to get the blog to appear around it as you drill down to single pics. Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.