Adding archive pages to CMS - php

(I am not sure if this is the proper place for this post. If not, just let me know where to repost it. I don't have a lot of experience with PHP. I 'know' just enough to be dangerous.)
I am using the CMS, HTMLy, and am trying to list the archives on a separate page, instead of a side column.
In the main page the following command is used to display the archives in the column:
<?php echo archive_list() ?>
However, I am having a problem getting the PHP to display the list on a web page. The system uses markdown (.md) so I can't run it from there.
Any suggestions?

Related

Dynamic sub nav

Ive created a portfolio website for myself, there is a gallery which users can enter, click on a thumbnail and then go to a new html page with the full image and description. Now on this full image page i have a list of other fullimage pages for project 2,3,4,5, etc..
But obviously manually updating project2.html to have a list of all other projects minius project 2 in the sub nav is very tedious and mistakes will occus when i have to do it for all 12 plus pages. So im after the page people are viewing not to appear in that sub nav.
My problem is.. Do i scrap the custom html site and move onto a cms.. The logical step for this sort of dynamic nav. Or do i try and include php if possible. Can anyone suggest the best approach for this, im aware it might in the longrun be easier to run off a cms but i do like the control i get and knowledge i hand crafted my html.
Thanks
Mat
If you wanted to do this with php, you could do so by making a single file containing the navigation, for example nav.html:
Project 1
Project 2
Project 3
all the project pages would then need to be php files, with the appropriate .php extension, and in each of them you would have:
<p>All your normal page html about the project and such that's above your navigation</p>
<?php
include("nav.html");
?>
<p>Anything underneath your navigation</p>
Alternatively, the CMS is a viable choice, or if you particularly fancied learning some php, you could actually code a perfectly servicable system to do this without too much trouble yourself.
If your don't want to use CMS , you can create a php file to handle requests for example , a php file that receive this request :
http://myfolio.com/moreinfo.php?album_id=1&
now in the php file you can get informatin from DB and folders then create a HTML Stream and then output it.

How do I create simple module from already existing PHP script that will display on the main column

I have already working guestbook script, which I’d like to add to my prestashop on a separate page. The problem is, that I can’t find where to place it.
I’ve browsed through a lot of modules, but it looks like all of them are registering to either left or right column hook. What I need is to display the script in the middle column, which basically consists of only calling one or two methods that will render out the correct html.
I don’t need to do anything with configuration or accessing the prestashop database, or even create a page in the administration. Basically the same thing I’m trying to achieve could be done using an iframe in a CMS page, where the iframe’s url would link to the guestbook script, but that really doesn’t seem like a clean solution to me.
Is there any simple way to make a separate php script display on the “main” center column?
Isn't the include able to help you?
<div><?PHP include(something)?></div>
<div><?PHP include(something else)?></div>
etc
you can place if conditions if needed.

Open page in Joomla

I'm using Jumi to echo php code and then showing that in a Joomla Article, and everythings working fine. Now I want to do this:
The output is basically a list from a database like this:
Name Price Type
A 1 T1
B 2 T2
In this list I want to include links to only show items of the same type, so "T1" would like to a page only showing things of type T1. So I thought I would do this by making a new page that takes a type and then get all the items of that type from the database. Without Joomla this wouldv'e been a piece of cake, with Joomla I'm not quite sure where to begin.
How should the a href=... tags in the html code printed by my php script look?
Is my basic structure still correct, and if so, how do I make Joomla open the new page in the normal frame and not replace the whole Joomla page. some kind of target-frame attribute?
EDIT:
I know I should be using a component instead, however I just need to get this working before going on vacation in three days. I will do it properly when I get back.
I don't mind if the entire page reloads, what I do need is the Joomla menu, header-banner and other things around the page to be loaded as well. If I just use a href=mypage.php I assume the header and everything around it will disappear.
I think you are going about this all wrong. You shouldn't be using Jumi to run php in your articles. You should design a component. Although this will take a tiny bit longer to setup initially it will save you time in the long run and prove to be much more flexible than using Jumi in a single article. Have a look here on how to create a Joomla component - http://www.joomladevuser.com/tutorials/components.
a href= tags should not be any different from any other html you have ever used.
E.g. echo 'link';
To make just the frame/div/table/etc reload rather than the entire page you will need to implement some AJAX. I have answered a question on how to do this with Joomla components before, see here: how to use Jquery AJAX in Joomla Components?

How to add dynamicly linked and created pages in wordpress?

Since I had some comments on the formulation of my question, I decided to rewrite it completely. And also, I understand a little bit more about wordpress so it should make more sense now.
So, let's start with what I'm trying to accomplish by using a simple example:
Goal:
Make a search engine for some products and link to them using a database to generate the information.
Result:
http://my.site.url/wordpress/<plugin-name> <-- The page with the "search" and "search result
http://my.site.url/wordpress/<plugin-name>/products/<product_name> <-- When click on a search result
Part 1:
I want to make a plugin with the name "plugin-name" Right now, I put my code in
http://my.site.url/wordpress/wp-content/plugins/<plugin-name>
On the activate, I create some tables with some data. Since there is no page yet, I create 1 on the fly using the API call 'wp_insert_post'. I give the name and slug "myPlugin".
So, when I go on the main site, I can see my newly created page "myPlugin". But right now, there is no content attached to it. To do so, from what I understand, I need to create a page in my plug-in directory named "myPlugin.php".
http://my.site.url/wordpress/wp-content/plugins/<plugin-name>/myPlugin.php
So, how do I link the page I created manually and the source file in the plugin directory?
Part 2
When clicking on a link in the search result, I would like to have a page "product.php" and display its information. So, is it possible to create a "temporary url" for the result using sub pages (see result at the beginning)? And if possible, how can we achieve that?
Thanks in advance and I hope it's clearer.
u can find how to create plugin from
http://ditio.net/2007/08/09/how-to-create-wordpress-plugin-from-a-scratch/
in plugin write function for search(as per u r logic) fetch result
create a custom page refer video from www.wordpressmax.com/customize-wordpress/custom-page
in custom pages template in between get_header(); and get_footer(); call search function and display records.
Thats it.
thisMayhem is right. This sounds like a bunch of nonsense. But, if you're trying to make a WP page that executes some custom PHP, look up the WP template hierarchy.
What you can do is this:
create a WP "page" - call it "Search results."
create a template directory file called page-search-results.php (filename corresponds with slug of page from step 1)
put some generic header/footer stuff there (see other template files - most often it's just a question of putting in <?php get_header(); ?> and <?php get_footer(); ?>)
put PHP code in that thar page. in them hills.
if you use a caching plugin, may want to put an exemption for /search-results/
So, when someone pulls up http://your.site/search-results/ - your custom PHP code will execute. It's up to you to make that logic and communication happen - whether via $_GET or $_POST, etc.
I'm sorry you're experiencing some problems. Unfortunately as we say above because it's a 'one off' for a client project we can't support it - it works for them :) Feel free to rip it apart and retest and if you have any success let us know.

WordPress - PHP Code Box

I am very new to WordPress, so I would appreciate some help.
I am using WordPress as a CMS, and I am trying to make the thing work so that when I select a page to edit, there is a special box where I can input PHP code that will execute on my page.
I have found the PHP exec plugin, which works perfectly, but I would like to keep the code out of my main text editor, out of the way of my client's careless fingers.
Any suggestions would be very, very appreciated. Thanks!
You could create a template for each one, and include your PHP there.
Simply select the template from the page edit page.
But if you are only including a little PHP per page, you could get the slug via WordPress in your page template and act on it accordingly.
You can also add an extra meta box on the post editor page, only visible to you, with a textarea where you can add the code. You would save it as a meta field of the post. Your template can check for the existence of this field, and execute it if found.
PHP Exec is the best plugin I have found, and I looked long and hard for that one. The problem with doing it as you suggest is that if the PHP code displays an item on the page, it still has to be formatted within the page as well. It is a simple logistical problem, but somewhat of a complex coding problem. I haven't been able to get around to working on creating a better plugin for it.

Categories