INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Wordpress with non-PHP pages

Wordpress with non-PHP pages

(OP)
Hi,

I'm a wordpress noob, so please be gentle!

Does every page in a wordpress site have to be PHP?

Is it possible to have a cgi-bin for example and have some Perl scripts?

Can I include some static HTML?

Does WP pre-process every page request that gets called from a WP's content folder?

Help understanding the semantics and compatibility is appreciated.

Regards,
1DMF

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages


1. pages are not usually in the wp-content folder. the themes might be (usually are). these are pre-processed. yes.

Quote:


Does every page in a wordpress site have to be PHP?
yes, ish. in that every page request is parsed by wordpress and usually rendered by php. typically page content is text taken from a database, although the theme template or wp settings may also specify the inclusion of widgets and similar (which are pieces of active content).

Quote:


Can I include some static HTML?
yes - just edit the relevant theme page. you can also create theme templates that are specific to a distinct post or page or category thereof (etc).

Quote:


Does WP pre-process every page request that gets called from a WP's content folder?
again - slightly misleading because page reuqests are not called from wp-content. the wp-core parses the request, examines its database and then decides whether it has to go find a template or serve up something else (plugins can interrupt this process). but essentially the answer is yes - wp will handle all incoming requests. there are ways around this through judicious manipulation of htrewrite rules, but I wouldn't bother.

Quote:


Is it possible to have a cgi-bin for example and have some Perl scripts?
yes. but it may not be easy. you will have to write connectors and inject the content into the template via a plugin or editing the plugin itself. the connector may be as simple as using file_get_contents() etc. but in any event, why bother with perl when you have the power of php?

note that (without plugins) you cannot include php code in a post or page. it will just be rendered as text. to include the code you must edit the template. Although, as said, there are plugins that will enable the exec() of php code in a post. using one comes with serious health warnings though.

RE: Wordpress with non-PHP pages

(OP)
thanks jpadie.

The problem I have is the graphic designer outsourced a request for a WP theme based on his design.

What we got was a butchered Twenty Twelve POS template, invalid mark-up, non-semantic, 'cowboy' quality coding, forms that don't work, links that don't work, missing pages... the list goes on.

I guess I'll have to bite the bullet and see if I can complete the template using PHP (no doubt I'll be coming here to seek your advice for the foreseeable future!), but as I know Perl and they want the site to go live yesterday (aint that typical!), it would be quicker and easier for me to finish the missing bits with Perl / JS / CSS / HTML.

The point of supposedly getting a WP theme was so others could amend content via the WP admin and theme controls, without the need of a coder (or me) to make the changes for them.

The template is so butchered and badly constructed half the normal default functionality in WP doesn't even work! banghead ,

We got such a pile of flush3 , it has been a waste of time, money, resources, and now I'm left to clean up the mess! hairpull3

Keeps me busy I guess and won't hurt to add another string to my C.V. bow winky smile

N.B. - We don't do posts / comments , and only work with pages, which I'm hoping will make things a little easier to fix!

Also this is on Windows IIS7 - so htrewrite (if you mean mod-rewrites) aren't possible, but IIS7 does have a re-write engine!

I've already grasped things like

CODE

<?php echo esc_url( home_url( 'my page' ) ); ?> 
(well I think I have) to ensure the correct path is used for the place where the template PHP files reside for hrefs/ img src etc..

I'm sure I'll pick up enough to get the job done, just hoped I could easily circumvent PHP and finish it in Perl, alas, it would have been simpler, easier, quicker, better quality and adjustable, if they had simply given me the design and let me mark-up / code the site.

Instead of making things better they have made them 10 times worse with the crappy template, locked into WP with an admin interface that doesn't work!

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages

feel free to contact me offline to share the design requirements and the code that you have. I may have stuff in the code bank that will help getting you to your goal.


if you don't have my address you can find it on my sadly unused blog at rathercurious.net.

RE: Wordpress with non-PHP pages

I think that most Wordpress "template designers" simply 'butcher' one of the standard themes, though [deity] kows why. It's a damned site easier to start from scratch, and don't get me started on 'frameworks'!

Chris Coyier has a 'Blank' template that you can build on.

Quote:

N.B. - We don't do posts / comments , and only work with pages, which I'm hoping will make things a little easier to fix!
It will once you have it set up to work that way.


Quote:

Is it possible to have a cgi-bin for example and have some Perl scripts?
Of course you can, just put a link in one of the template parts or write a extra bit for the templates.

I've just converted a site that was entirely ASP script driven to WordPress with very little problem. (other than the client not liking proportional resizing but not wanting images to distort, when an image that was uploaded at 2460x2506 px was resized to 130x180 px, so I've had to code a way to let him resize and upload seperate thumbnails (because he's been doing that since 1998 and he does not see why it needs to change!)
Hey ho!!





Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: Wordpress with non-PHP pages

(OP)
Thanks Chris.

Quote:

Of course you can, just put a link in one of the template parts or write a extra bit for the templates.

So I just link to a CGI-BIN folder and make sure it's mapped to Perl and away / I go like normal, hoped it would be that simple.

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages

not quite no.

or if you do you risk breaking the wordpress theme on the next refresh as a .pl extension is not typically parsed by the php engine.

the easiest route, without testing, would be to grab the output of the perl script (or whatever) by calling it via file_get_contents() if it were a web type output. so say a widget were displayed at this web address http://my.domain.com/scripts/script.pl you would do this

CODE

$content = file_get_contents("http://my.domain.com/scripts/script.pl"); 

if you did not need the help of the webserver to get the desired output from the perl script, you could do this

CODE

passthru('/usr/bin/perl /path/to/perl.script.pl'); 
this directly outputs the result of the script. if you want to capture and use the output in a variable, you would do this

CODE

exec('/usr/bin/perl /path/to/perl.script.pl', $content);
//note that $content will be an array. so if you want a string, collapse it before use
$content = implode("\n", $content); 


make sure that the php process has execute writes on perl of course. determine the relevant user with this

CODE

exec('whomai'); 

but ... honestly ... php is such an easy and hugely powerful language that converting will almost certainly easier for you in even the short term. I'd be happy to rewrite a perl script for you in php to give you a heads up on the right approach. choose a sufficiently complex one to give the best flavour.

RE: Wordpress with non-PHP pages

(OP)
Well I'm not trying to retrieve output from a Perl script, I want to process a submitted form via the action attribute to Perl with AJAX and email the data.

The other problem I have is, a lot of the content and where I want to put the URI's are not in the PHP, the content is driven from the WP interface and the 'Pages' section.

It seems some of the images they have in the page are as follows...

CODE

<div class="scrolling small events">
    <ul>
      <li><img src="/wp-content/uploads/2013/06/HLP_Slide_SML_JohnM.jpg" width="346" alt="Slideshow"></li>
      <li><img src="/wp-content/uploads/2013/06/HLP_Slide_SML_CarolF.jpg" width="346" alt="Slideshow"></li>
      <li><img src="/wp-content/uploads/2013/06/HLP_Slide_SML_BobH.jpg" width="346" alt="Slideshow"></li>
    </ul>
    </div> 

As I mentioned before the content seems to be in wp-content, not in the template folder and I just tried to include a folder in the template area and got

Quote:

403 - Forbidden: Access is denied.

with the following URL

CODE

<div class="textwidget center">
                <a href="/wp-content/themes/hlp/BDF_Apr2013_Photos/"><img src="/images/bdf_galleries.png" alt="Past BDF Galleries" width="150" class="BDF"></a>
            </div> 

I don't understand where I put stuff that is for the specific template I am working on and then hyperlink to it?

What location is the template's public area?

Thanks,
1DMF

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages

(OP)
OK, been a bit of a doughnut, I assume the parser is looking for index.php as default and so the fact I had an index.html in the folder, it was trying to list the content of the folder , which I have forbidden, hence the 403!

So I renamed the page

CODE

/PhotoAlbum.html 
and included that in the anchor URL and it is working!

Phew, getting somewhere!

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages

Quote:


Well I'm not trying to retrieve output from a Perl script, I want to process a submitted form via the action attribute to Perl with AJAX and email the data.

i see, there is no problem with you addressing form actions outside of wordpress, via ajax or otherwise. of course if it is a proper page action then the cgi-script would need to redirect back to the wordpress blog, as php won't have been fired up and be doing its thing otherwise.

Quote:


As I mentioned before the content seems to be in wp-content
ah yes. images and non-text content are contained in folders typically under the wp-content folder.

Quote:


where I want to put the URI's are not in the PHP, the content is driven from the WP interface and the 'Pages' section.

sorry - i don't understand that. but just in case, you access image content by using tags in wordpress, that relate to the postID with which that image is associated. you should not directly link to the content using the full or relative url. But typically you don't need to do this at all, as it is all automatically sorted out by wordpress when you display a post or a page (page = wordpress page, not web-page).

If you want an image in your template (as opposed to being part of a post or page [in the wordpress sense of the word]) then store the image in the template directory (not the uploads directory) and use this method of linking to it. content stored in the uploads folders is liable to be moved around by things changing within the post/page architecture.

CODE

<img src="<?php bloginfo('template_directory'); ?>/images/imagename.png" alt="" width="xxx" height="xxx" /> 

RE: Wordpress with non-PHP pages

(OP)
OK, I think there is some confusion between what's in the 'template' vs 'page'.

The PHP code only seems to be parsed if in the template, but most of the content is obtained via the page through the WP admin 'Pages' section, which I assume is stored in the MySQL DB.

The problem I have is I want to have includes in the 'page' content (not the template) , so for example I added this to the page content via the WP Admin...

CODE

<li id="text-4" class="widget widget_text">
		<?php include "hlp_enquiry.php"; ?>
</li> 

But it merely has that as part of the source, so the content added via the WP Admin is not being parsed by the PHP interpreter.

How do I use PHP includes (or any other) , so I can create a separate enquiry form and then included it on various pages via the 'Pages' section of the WP admin interface?

From what I can tell the entire site only has one template for rendering pages...

CODE

<?php remove_filter( 'the_content', 'wpautop' ); ?>

    <?php get_header(); ?>

	<?php while ( have_posts() ) : the_post(); ?>
			
	<?php the_content(); ?>						

	<?php get_footer(); ?>


    <?php endwhile; // end of the loop. ?> 

They had hard coded the enquiry form (very badly) in every page we want the form to show, rather than having one enquiry form and use an include where required.

How do I achieve this?

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages

Quote:


The PHP code only seems to be parsed if in the template, but most of the content is obtained via the page through the WP admin 'Pages' section, which I assume is stored in the MySQL DB.

php code is (typically) only parsed in templates and plugins. there are ways around this using plugins, not recommended.

'content' in the sense of blog posts and wordpress 'pages' are stored in the database and rendered via theme templates.

Quote:


The problem I have is I want to have includes in the 'page' content (not the template) , so for example I added this to the page content via the WP Admin...

that's not what a wordpress 'page' is about. sounds like you want to create a page template specific to that page. then create a blank page in the wordpress admin tool and tell wp to use that template for that page. when using wp as a framework, this is the normal method of creating internal links within the wp hierarchy but having full control of the content. or create a widget and include the widget via the admin panel.


Quote:


From what I can tell the entire site only has one template for rendering pages...

that's possible, but very unusual. but the "loop", which is the essence of what you posted, is the heart of any web-page on which blog-posts are displayed.

CODE

They had hard coded the enquiry form (very badly) in every page we want the form to show, rather than having one enquiry form and use an include where required.

How do I achieve this? 
use an include in the template for the pages on which you want the form to show. but please distinguish (in your mind and in the posts here) between a wp-page and a web-page. They are not the same thing ... a wp-page is for content that is outside of the blog timeline.

for includes, remember to use blog_info to help you create the url references to the file in question, so that if you move/migrate your blog the links and includes will still work.

RE: Wordpress with non-PHP pages

(OP)
Still confused, you keep mentioning blog posts. There are no blog posts, only pages.

As mentioned all pages are rendered by this one php file...

CODE

hlp_html_temp.php 

How do I tell WP to use a different template for a specific page?

On the page attributes section for 'template' there is only two choices either 'HLP Template' or 'Default Template' , I guess what I need to be able to do is either add another template option to the dropdown, but then that would mean any changes would have to be made to the PHP template, and the company doesn't want that, they want to be able to control the content of a page via the WP admin 'Pages' section.

So I guess the only option is to include a widget, so now I need to know how I write a php file that can be a widget and then use it via the normal WP syntax for including a widget in a page.

I also looked into http://codex.wordpress.org/Function_Reference/blog... , not sure what you are implying I use it for, nothing is going to move.

This is in essence a static site, that they want to be able to control the content with WP as a simple CMS.

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages

(OP)
I'm losing the plot here, I can't find any way of adding a widget to a page.

There are a load of widgets in the widget area, but they don't appear on any page and I have no idea how to get one to appear?

All I can find is this.. http://wordpress.org/plugins/widgets-on-pages/

Is this the only way to include a widget in a WP page?

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages

Quote:


Still confused, you keep mentioning blog posts. There are no blog posts, only pages.
just so that my answers are complete, to avoid confusion and for other readers. there is no intrinsic difference within wordpress between a page and post, other than a page sits outside the timeline. they are treated the same internally.

Quote:


As mentioned all pages are rendered by this one php file...

that's up to you. but it does not sound sensible. this links should help you.

Quote:


How do I tell WP to use a different template for a specific page?

in the page admin site. see the image below


Quote:


On the page attributes section for 'template' there is only two choices either 'HLP Template' or 'Default Template'
add a new template to the relevant theme folder. this link may help.
You must include a special header in the template file so that wp can recognise it. the format looks like this

CODE

<?php
/*
Template Name: my page level template
*/
?> 
the next time you visit the admin site, the new template will be in the drop down.

Quote:


but then that would mean any changes would have to be made to the PHP template, and the company doesn't want that, they want to be able to control the content of a page via the WP admin 'Pages' section.
it is a terrible idea to allow changes to a template through the pages system. those screens are for content, not mark-up and dynamic content. use widgets for customisable dynamic content blocks. note there is also a template editor available in the wp-admin site - but this should be restricted to people who know intimately what they are doing.

Quote:


This is in essence a static site, that they want to be able to control the content with WP as a simple CMS.
well ... that's not what wordpress is designed for, but once you fully grok how it works and how it puts pages together, you can easily make it into a CMS framework. just make really sure that you lock all admin functionality away from anyone that is not fully conversant in the depths of wordpress. or build a complete overlay that allows granular access to bits which can't unravel the universe. there are plugins that can help you with that.

but ... bottom line - if you want dynamic content on static pages within wordpress the only sensible way to go is with custom templates. everything else is a bodge job.

having fired off that warning - there are plugins that allow you to put php content directly into the page editor, and to have it parsed on display of the page. really: here be major dragons. users can delete your entire blog by doing this. but if you really want this: http://wordpress.org/plugins/allow-php-in-posts-an...

RE: Wordpress with non-PHP pages

(OP)

Quote:

that's up to you. but it does not sound sensible

? it's not up to me this is the template I have been given from the web design company and that's how it works. If it was up to me , it would already be live using semantic valid X/HTML 1 strict mark-up and powered by Perl!

As I mentioned, if I start adding templates, the content is not editable via the pages WP admin.

CODE

or build a complete overlay that allows granular access to bits which can't unravel the universe. 
That was the point of outsourcing a WP theme, only we didn't get that and that's why they won't be getting paid the final balance!

I guess I'm going to have to create bespoke templates for each page that has a widgitised area, some how work out how you write a widget and then include it on the pages.

If they want anything changing then they will have to ask me or get someone who knows PHP / WP , talk about a waste of a grand! - I could have gone on a WP/PHP course with that!

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages

(OP)
oh I found this in the function.php file...

CODE

register_sidebar(array('name'=>'General Widget',));
	register_sidebar(array('name'=>'Executive Widget',));
	register_sidebar(array('name'=>'Membership Widget',));
	register_sidebar(array('name'=>'Event Widget',));
	register_sidebar(array('name'=>'Publications',));
	register_sidebar(array('name'=>'Contact Widget',));
	register_sidebar(array('name'=>'Ethos Widget',));
	register_sidebar(array('name'=>'Compliance Widget',));
	register_sidebar(array('name'=>'IT Widget',));
	register_sidebar(array('name'=>'Marketing Widget',));
	register_sidebar(array('name'=>'Products & Services',));
	register_sidebar(array('name'=>'Academy Widget',)) 

And in the widget area of WP admin there are all this widgets on the right hand side, but I cannot drag / move them, and they don't appear anywhere on any page, what is this junk?

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages

Add widgetized areas through a sidebar and then include the sidebar reference in the page templates. That's the best way to manage things like that.

Potentially you could write a plugin that enables custom short codes and create some short codes that would inject CSS to hide elements on the page. The short codes can be included in the body of posts.

My offer still stands. Let me have the site design and the templates you have a t the moment and I can give you an honest opinion of what it would take to knock it into shape. I may be able to do some of it myself. Gratis of course. You can get hold of me via apples icloud domain at my TT handle. I will have time later this evening to take a proper look.

In my experience unless a theme is very complex and/or needing loads of custom widgets or paraneterisation it should not take more than a few hours to create. Graphic creation aside.

RE: Wordpress with non-PHP pages

Those look like created sidebars that your developer has created. It is correct that they should be registered and using functions.php is one way to do so.
At a guess he has created whole sidebars as widgetised entities.

RE: Wordpress with non-PHP pages

(OP)

Quote:

Those look like created sidebars that your developer has created.
yes, and then the sidebar has a text widget with this junk hardcoded in it

CODE

<script type="text/javascript">if (typeof(ecfconfig) == 'undefined'){var ecfconfig={};}ecfconfig[2]={};var ufobaseurl =  'http://hlp.pxldev.net/wp-admin/admin-ajax.php';if (typeof(ufoFormsConfig) == 'undefined') {var ufoFormsConfig = {};ufoFormsConfig.submits = [];ufoFormsConfig.resets = [];ufoFormsConfig.validations = [];}ufoFormsConfig.phonenumberre = /^(\+{0,1}\d{1,2})*\s*(\(?\d{3}\)?\s*)*\d{3}(-{0,1}|\s{0,1})\d{2}(-{0,1}|\s{0,1})\d{2}$/;</script><link href="http://hlp.pxldev.net/wp-content/plugins/easy-contact-forms/forms/styles/easyform/css/std.css?ver=1.4.2" rel="stylesheet" type="text/css"><style>.form_container {
background:url('/images/form_bg.png') center no-repeat !important;
height: 500px;
padding-top: 50px;
}

.ufo-customfields-invalid  {
margin-left: 12px !important;
width: auto !important;
border: none !important;
background-color: transparent !important;
margin-top: 7px !important;
}

.ufo-customfields-valid {
margin-left: 18px !important;
width: auto !important;
border: none !important;
background-color: transparent !important;
margin-top: 4px !important;
}

.ufo-form-submit-success {
background:url('/images/form_success.png') no-repeat !important;
background-position: 0px center !important;
height: 291px;
width: 340px !important;
margin:0 !important;
padding: 0 !important;
font-size: 0;
}
</style><div class="ufo-form" id="ufo-form-id-2"><noscript><form method='POST'><input type='hidden' name='cf-no-script' value='1'></noscript><input type="hidden" value="ufo-form-id-2" name="hidden-2" id="ufo-form-hidden-2"><input type="hidden" value="home-2" name="ufo-form-pagename" id="ufo-form-pagename"><input type="hidden" value="48b8170d63bb743e87e9436973437c2c1369235108" name="ufo-sign" id="ufo-sign"><div class="form_container"><div class="ufo-customfields-container-description" style="margin-left: 22px;
width: 223px;"><br>
<p style="font-size:13px;">Give us a call on <b style="font-size:14px;">01903 602 664,</b>  or fill in the enquiry form below and we'll get in touch with you.</p>

<p class="form-note">Note: <span style="color: #bf1e2e;font-weight:bold;">*</span></p> <p class="form-note2">denotes a required field.</p></div><div class="ufo-fieldtype-4 ufo-customform-row ufo-row-676" style="margin-top:2px;"><div class="ufo-cell-676-1-row" id="ufo-cell-676-1"><span class="ufo-cell-center" id="ufo-cell-676-1-center"><label for="ufo-field-id-676" style="margin-left: 50px;
">Name<span class="ufo-customfields-required-suffix" style="color: #bf1e2e;font-weight:bold;">*</span></label></span><span class="ufo-cell-right" id="ufo-cell-676-1-right"><p style="display:none"></p></span></div><div class="ufo-cell-676-2-row" id="ufo-cell-676-2"><span class="ufo-cell-center" id="ufo-cell-676-2-center"><script type="text/javascript">ufoFormsConfig.validations.push({"events":{"blur":["required","minmax"]},"Required":true,"Validate":true,"showValid":true,"ValidMessageAbsolutePosition":true,"ValidMessagePosition":"right","AbsolutePosition":true,"RequiredMessagePosition":"right","min":"3","max":"30","id":"ufo-field-id-676","form":"ufo-form-id-2"});</script><input type="text" id="ufo-field-id-676" value="" name="id-676" class="name_box" style="margin-left: 50px;
font-size: 10px;
height: 12px;
border-radius:10px;
border: 1px solid #000;"><div style="position: absolute; display: none;" id="ufo-field-id-676-invalid" class="ufo-customfields-invalid ufo-hint-position-right"></div><div id="ufo-field-id-676-valid" style="display: none; position: absolute;" class="ufo-customfields-valid ufo-hint-position-right"></div></span><span class="ufo-cell-right" id="ufo-cell-676-2-right"></span></div></div><div class="ufo-fieldtype-5 ufo-customform-row ufo-row-701" style="margin-top:2px;"><div class="ufo-cell-701-1-row" id="ufo-cell-701-1"><span class="ufo-cell-center" id="ufo-cell-701-1-center"><label for="ufo-field-id-701" style="margin-left: 50px;
">Email<span class="ufo-customfields-required-suffix" style="color: #bf1e2e;font-weight:bold;">*</span></label></span><span class="ufo-cell-right" id="ufo-cell-701-1-right"><p style="display:none"></p></span></div><div class="ufo-cell-701-2-row" id="ufo-cell-701-2"><span class="ufo-cell-center" id="ufo-cell-701-2-center"><script type="text/javascript">ufoFormsConfig.validations.push({"events":{"blur":["required","email"]},"Required":true,"Validate":true,"showValid":true,"ValidMessageAbsolutePosition":true,"ValidMessagePosition":"right","AbsolutePosition":true,"RequiredMessagePosition":"right","id":"ufo-field-id-701","form":"ufo-form-id-2"});</script><input type="text" id="ufo-field-id-701" value="" name="id-701" style="margin-left: 50px;
font-size: 10px;
height: 12px;
border-radius:10px;
border: 1px solid #000;"><div style="position: absolute; display: none;" id="ufo-field-id-701-invalid" class="ufo-customfields-invalid ufo-hint-position-right"></div><div id="ufo-field-id-701-valid" style="display: none; position: absolute;" class="ufo-customfields-valid ufo-hint-position-right"></div></span><span class="ufo-cell-right" id="ufo-cell-701-2-right"></span></div></div><div class="ufo-fieldtype-16 ufo-customform-row ufo-row-679" style="margin-top:2px;"><div class="ufo-cell-679-2-row" id="ufo-cell-679-2"><span class="ufo-cell-left" id="ufo-cell-679-2-left"><label for="ufo-field-id-679" style="margin-left: 50px;">Telephone<span class="ufo-customfields-required-suffix" style="color: #bf1e2e;font-weight:bold;">*</span></label></span><span class="ufo-cell-center" id="ufo-cell-679-2-center"><script type="text/javascript">ufoFormsConfig.validations.push({"events":{"blur":["required","phonenumber"]},"Required":true,"Validate":true,"showValid":true,"ValidMessageAbsolutePosition":true,"ValidMessagePosition":"right","AbsolutePosition":true,"RequiredMessagePosition":"right","id":"ufo-field-id-679","form":"ufo-form-id-2"});</script><input type="text" id="ufo-field-id-679" value="" name="id-679" style="margin-left: 50px;
font-size: 10px;
height: 12px;
border-radius:10px;
border: 1px solid #000;"><div style="position: absolute; display: none;" id="ufo-field-id-679-invalid" class="ufo-customfields-invalid ufo-hint-position-right"></div><div id="ufo-field-id-679-valid" style="display: none; position: absolute;" class="ufo-customfields-valid ufo-hint-position-right"></div></span><span class="ufo-cell-right" id="ufo-cell-679-2-right"></span></div></div><div class="ufo-fieldtype-4 ufo-customform-row ufo-row-678" style="margin-top:2px;"><div class="ufo-cell-678-2-row" id="ufo-cell-678-2"><span class="ufo-cell-left" id="ufo-cell-678-2-left"><label for="ufo-field-id-678" style="margin-left: 50px;">Postcode<span class="ufo-customfields-required-suffix" style="color: #bf1e2e;font-weight:bold;">*</span></label></span><span class="ufo-cell-center" id="ufo-cell-678-2-center"><script type="text/javascript">ufoFormsConfig.validations.push({"events":{"blur":["required","minmax"]},"Required":true,"Validate":true,"showValid":true,"ValidMessageAbsolutePosition":true,"ValidMessagePosition":"right","AbsolutePosition":true,"RequiredMessagePosition":"right","min":"6","max":"8","id":"ufo-field-id-678","form":"ufo-form-id-2"});</script><input type="text" id="ufo-field-id-678" value="" name="id-678" style="margin-left: 50px;
font-size: 10px;
height: 12px;
border-radius:10px;
border: 1px solid #000;"><div style="position: absolute; display: none;" id="ufo-field-id-678-invalid" class="ufo-customfields-invalid ufo-hint-position-right"></div><div id="ufo-field-id-678-valid" style="display: none; position: absolute;" class="ufo-customfields-valid ufo-hint-position-right"></div></span><span class="ufo-cell-right" id="ufo-cell-678-2-right"></span></div></div><div class="ufo-fieldtype-3 ufo-customform-row ufo-row-680" style="margin-top:2px;"><div class="ufo-cell-680-2-row" id="ufo-cell-680-2"><span class="ufo-cell-left" id="ufo-cell-680-2-left"><label for="ufo-field-id-680" style="margin-left: 50px;
width:200px;">Current Status</label></span><span class="ufo-cell-center" id="ufo-cell-680-2-center"><select id="ufo-field-id-680" value="" name="id-680" style="font-size: 10px;
margin-top: -1px;
height: 26px;
width:110% !important;
border: 0;
border-radius:0;
background: transparent;
-webkit-appearance: none;
-moz-appearance: none;"><option value="">Please Select...</option><option value="Appointed Representative ">Appointed Representative </option><option value="Adviser">Adviser</option><option value="Directly Authorised">Directly Authorised</option><option value="Other">Other</option></select></span></div></div><div class="ufo-fieldtype-10 ufo-customform-row ufo-row-702" style="margin-top:2px;"><div class="ufo-cell-702-1-row" id="ufo-cell-702-1"><span class="ufo-cell-center" id="ufo-cell-702-1-center"><label for="ufo-field-id-702" style="margin-left:50px;">Any Other Information</label></span></div><div class="ufo-cell-702-2-row" id="ufo-cell-702-2"><span class="ufo-cell-center" id="ufo-cell-702-2-center"><textarea id="ufo-field-id-702" name="id-702" style="margin-left: 50px;
font-size: 10px;
height: 40px;
border-radius:10px;
border: 1px solid #000;"></textarea></span></div></div><div class="ufo-fieldtype-6 ufo-customform-row ufo-row-682" style="margin-top:2px;"><div class="ufo-cell-682-2-row" id="ufo-cell-682-2"><span class="ufo-cell-center" id="ufo-cell-682-2-center"><script type="text/javascript">var c = {};c.id = 'ufo-field-id-682';c.form = 'ufo-form-id-2';c.Label = 'Submit'; c.CSSStyle='margin-left: 260px;margin-top:24px;background:transparent !important;border:1px solid #000;border-radius:6px;padding-left:5px;padding-right:5px;padding-top:1px;padding-bottom:1px;';ufoFormsConfig.submits.push(c);</script><span id="ufo-field-id-682-span"><noscript><button type='submit' id='ufo-field-id-682' name='id-682'  style='margin-left: 260px;margin-top:24px;background:transparent !important;border:1px solid #000;border-radius:6px;padding-left:5px;padding-right:5px;padding-top:1px;padding-bottom:1px;'>Submit</button></noscript><button type="button" class="" style="margin-left: 260px; margin-top: 24px; background-color: transparent !important; border: 1px solid rgb(0, 0, 0); border-top-left-radius: 6px; border-top-right-radius: 6px; border-bottom-right-radius: 6px; border-bottom-left-radius: 6px; padding: 1px 5px; background-position: initial initial !important; background-repeat: initial initial !important;">Submit</button></span></span></div></div></div><div id="ufo-form-id-2-message"></div><noscript></form></noscript></div> 

But as there aren't any templates that utilise any of these custom sidebars, let alone the widgets contained in them, this WP site is a total mess!

The only way I can see of letting them include the enquiry form, that has been properly created with external CSS / JS and valid mark-up is to rewrite the enquiry form as a widget and then use the widgets_on_page plugin to allow a shotcode to be entered as content in the 'Pages' page so they can include the enquiry form where ever they desire.

The form is suppose to be an 'Easy Contact Forms' plugin, but it doesn't work, along with most of this pathetic excuse for a WP template!

Well I guess they learned a valuable lesson, if you outsource code development to a 3rd party and don't include the IT guy in the meetings, discussions or project specification, you are going to get burned!

I've now been passed this pile of doggy doo, and been told 'Over to you, make it work'... hairpull3

As you say, they are trying to use WP in the wrong way, and got the graphic designer to manage the project who doesn't know CSS / HTML or any type of code, instead of involving me in the project.

Plus as most of the pages content contains mark-up, what was the point of using wordpress, when editing a proper HTML page and uploading via FTP would be easier and at least you would have a decent text editor with syntax colour highlighting to help! not that awful excuse of an editor in WP, where you can't even use the tab key for indentation of code blocks!

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages

ummm ... those sidebar registers relate to dynamic sidebars. you won't find a file with the sidebar content in it (unless the coding is done oddly). the content of the sidebar will be generated dynamically.

each sidebar is normally incorporated into the template via a call to dynamic_sidebar (sidebarID) in the relevant template. but that does not _have_ to be the case. the sidebars can be injected via a plugin; which is sometimes the case for parameterised themes.

Quote:


valid mark-up is to rewrite the enquiry form as a widget

you don't have to rewrite anything. you can use a widget to include() the relevant markup from a pre-existing file (although including() js into a page is not best practice. better to use wp_enqueue functions.).

another approach is to write a plugin that creates and manages a new shortcode. something as simple as this might work

CODE

function showContactForm($attr){
 $content = file_get_content('path/to/contactForm'); //consider using bloginfo or ABS for better qualified urls
 return $content;
}
add_shortCode('showContactForm', 'showContactForm'); 

then, in posts/pages, your user can choose to show the contact form by doing this

CODE --> body

[showContactForm] 

if you need the content of the form to be dynamically rendered (i.e. parsed by php) then use this instead

CODE

function showContactForm($attr){
 ob_start(); 
 include('path/to/contactForm'); //consider using bloginfo or ABS for better qualified urls
 $content = ob_get_contents();
 ob_end_clean();
 return $content;
}
add_shortCode('showContactForm', 'showContactForm'); 

i've never used a contact form plugin as that kind of customer facing thing is too important to be left to a third party imo. it's only a form - roll your own every time is my advice. and don't use a form of visual captcha. instead use something like this

RE: Wordpress with non-PHP pages

(OP)
Well my idea seems to be working...

Firstly I created a new widget following this ...

http://www.makeuseof.com/tag/how-to-create-wordpre...

Then I installed it and added this plugin...

http://wordpress.org/plugins/widgets-on-pages/inst...

And now I can use....

CODE

[widgets_on_pages id=My Widget] 

Well in theory only it isn't working sad

Like everything wordpress nothing bloody works with WP 3.5.1+


"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages

that's just a shortcode. instead use my code and keep it simpler. put the code in functions.php.

RE: Wordpress with non-PHP pages

(OP)
ohh, just caught your post...

this could be exactly what I want...

CODE

function showContactForm($attr){
 $content = file_get_content('path/to/contactForm'); //consider using bloginfo or ABS for better qualified urls
 return $content;
}
add_shortCode('showContactForm', 'showContactForm'); 

seeing as I just wrote a Widget, and now widget_in_pages doesn't work!

Quote:

. you won't find a file with the sidebar content in it

Yeah, that's what I was saying, the templates would have calls to include certain sidebars and then you drop the desired widgets onto them in the WP widget area.

Only as the entire site is only one template page that doesn't have any sidebar inclusions , all that stuff is garbage and superfluous.

Anyway, do I need to create a plugin or can I add

CODE

function showContactForm($attr){
 $content = file_get_content('path/to/contactForm'); //consider using bloginfo or ABS for better qualified urls
 return $content;
}
add_shortCode('showContactForm', 'showContactForm'); 

to the functions.php file?

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

RE: Wordpress with non-PHP pages

just add it to functions.php

RE: Wordpress with non-PHP pages

Perfect. Well done!

If you want any help with the rest of the theme and getting it back to where it should be just let me know or post back in this forum.

RE: Wordpress with non-PHP pages

just for posterity, to other readers - don't use an include() inside a shortcode function unless you are capturing the content without printing to screen (using output buffering). the shortcode function must return the content, not echo it (otherwise it will be printed in the wrong place on the screen and may not even show up at all).

RE: Wordpress with non-PHP pages

(OP)
Just wanted to thank you guys (Jpadie / Chris),

With your help I now have a shortcode which processes a widgitised php file (the enquiry form), all JQueried and AJAXed which submits to the backend Perl processing script and emails the form to us via my own TLS encryption module.

Everything is tickertyboo peace

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close