Placing text on FW page from onsite or external file

I’d like to make a page which has a matrix of graphics each with a caption
underneath, that my son can update without coming back to me. To change in
FW

It’s pretty easy to link to an image as a passthrough, that he can change,
but I’d like to do the same with text, eg calling text from a file:
pano1.txt

I thought php would be the way to go, I’ve seen includes, but don’t know
enough about php for that to be really useful. I’ve also had a look to see
if there are any actions but have not found anything immediately useful.

Or is there another approach I should take?

Time to shout for the tech whizzes here!

Best wishes Peter

================================
Peter Tucker, Oxford UK email@hidden


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Using php includes is very easy to implement and doesn’t require
anything more than a .php file extension and a server that supports
PHP. You could also use an .inc file with the same results instead of
going the php route. Both work peachy. You may also consider something
simple like WebYep just for the sake of a friendly and simple GUI.
Lots of options.

Todd
Skype: toddbrilliant

On Dec 4, 2009, at 12:23 PM, Peter Tucker wrote:

I thought php would be the way to go, I’ve seen includes, but don’t
know
enough about php for that to be really useful.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Anybody have some step by step instructions on how to implement php includes into a FW page.

Cheers, Marcel


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

  1. Change the file extension of the [template] page that will hold the
    include to .php
  2. Create a new folder (name it ‘includes’)
  3. In the ‘includes’ folder create a new partial file with whatever
    content you want to insert. For example, myfile.html (this is the
    actual include)
  4. Apply the ‘PHP Make Insert Page’ action to the partial in step 3.
    Important: This action strips the page of all unnecessary markup.
  5. In the template page (step 1) insert a markup item where you want
    the content to appear and add:
<?php include'includes/myfile.html'; ?>
  • There may be an action that simplifies step 5, I don’t know. In any
    case this example works just fine.

Depending on your setup you may or may not be able to preview the
result locally in which case upload it.

You can also do this using .shtml and a slightly different include
markup (i.e., not php). Either works.

Todd

On Dec 4, 2009, at 3:13 PM, Helveticus wrote:

Anybody have some step by step instructions on how to implement php
includes into a FW page.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Tod,

That’s perfect works a dream. Now to extend the question:

I’d like do something similar, instead of making the images as passthrough,
I’d like to use php to drop them on the page Š that way there is no danger
when updating the FW site of me messing-up files my lad updates manually on
the site?

Thanks for you help, that’s one small step to me learning php ;~}}

on 04/12/2009 22:29, Todd at email@hidden wrote:

  1. Change the file extension of the [template] page that will hold the
    include to .php
  2. Create a new folder (name it ‘includes’)
  3. In the ‘includes’ folder create a new partial file with whatever
    content you want to insert. For example, myfile.html (this is the
    actual include)
  4. Apply the ‘PHP Make Insert Page’ action to the partial in step 3.
    Important: This action strips the page of all unnecessary markup.
  5. In the template page (step 1) insert a markup item where you want
    the content to appear and add:
<?php include'includes/myfile.html'; ?>
  • There may be an action that simplifies step 5, I don’t know. In any
    case this example works just fine.

Depending on your setup you may or may not be able to preview the
result locally in which case upload it.

You can also do this using .shtml and a slightly different include
markup (i.e., not php). Either works.

Todd

On Dec 4, 2009, at 3:13 PM, Helveticus wrote:

Anybody have some step by step instructions on how to implement php
includes into a FW page.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Best wishes Peter

================================
Peter Tucker, Oxford UK email@hidden


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Todd, thanks for the instructions.

I have been playing around with PulseCMS which basically generates php includes via a neat user interface using a trimmed down version of CKeditor.

In Peter’s case this might be handy for his son to use, he can update text and pictures within the PulseCMS admin interface. Pulse uses a flat file structure so no need for a database.

Marcel


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

One very simple way to do it would be to add this to the template page:

<?php echo ("<img src=$../../images/path.png>"); ?>
  • Of course change the path to match the image location.

Depending on the specifics of the layout, your requirements etc. this
may or may not be the best approach but you can try it nonetheless. If
you need to call the images from with another include (and not the
template) let me know, I’m sure there’s a way to do that also.

Todd
Skype: toddbrilliant

On Dec 5, 2009, at 7:28 AM, Peter Tucker wrote:

Hi Tod,

That’s perfect works a dream. Now to extend the question:

I’d like do something similar, instead of making the images as
passthrough,
I’d like to use php to drop them on the page … that way there is no
danger
when updating the FW site of me messing-up files my lad updates
manually on
the site?

Thanks for you help, that’s one small step to me learning php ;~}}


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I saw that recently, it does look interesting. I agree that using a
very lightweight CMS for this might make it a little more user-
friendly for Peter but I guess it depends on how may images etc. he
needs to deal with. If it’s just a couple then doing it manually may
be sufficient.

Todd

On Dec 5, 2009, at 12:52 PM, Helveticus wrote:

In Peter’s case this might be handy for his son to use, he can
update text and pictures within the PulseCMS admin interface. Pulse
uses a flat file structure so no need for a database.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

To clarify, to reference an image from within an include (or partial)
and not from the template you can do it in one of two ways.

Simply insert markup items with the appropriate tags and path,
for example:

<img src="../../images/path.png">

Or you can insert a graphic box and import an image. However, I’ve
sometimes had FW-related path issues with this method though your
mileage may vary. In any case I’m sure there’s a simple fix for the
path problem, I just prefer to type mine manually.

Todd

On Dec 5, 2009, at 12:53 PM, Todd wrote:

If you need to call the images from with another include (and not
the template) let me know, I’m sure there’s a way to do that also.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You could agree on a file naming scheme to get the caption in there
automatically. Here’s how I would do that:

Name your files in a pattern like this:

  • 01_here’s_a_little_song_I_wrote.jpg
  • 02_you_might_want_to_learn_it_note_for_note.jpg
  • 03_don’t_worry–be_happy.jpg

Then you upload those files into a folder inside your site root, and
using PHP, read the directory of files into an array so you can
process them further:

<?php
$base = dirname(__FILE__);
$root = $_SERVER['DOCUMENT_ROOT'];
$prefix = str_replace($root,'',$base) . '/';
$dir = scandir($base);
foreach($dir as $f){
	if(!is_dir($base . '/' . $f) && substr($f,-3) == 'jpg'){
		$caption = preg_replace('/d+_(.+?)/','$1',substr($f, 
0,strrpos($f,'.')));
		$caption = htmlspecialchars(str_replace('_',' ',$caption));
		print '<p><img src="' . $prefix . $f . '" alt="' . $caption . '" / 
 ><br />' . $caption . '</p>';
	}
}
?>

Save that code in a text file named index.php and put it in the same
folder as the photos. When you browse to the folder, you should get a
single paragraph for each photo in that folder, with the filename
processed into the caption. (The leading numbers and underscore and
the .jpg extension are stripped off, then the remaining text has its
underscores turned back into spaces.)

You can style these paragraphs to line up like a slide sorter, or you
could expand the example above to use different HTML so you could
style it up more elaborately. (The line that begins with the print
command is the only part of this that creates any output, all the rest
is juggling the folder and filenames.)

To use this as an include within Freeway, just include it in your
layout (using a Markup Item) where you want the photos to appear on
your page.

Walter

On Dec 4, 2009, at 1:23 PM, Peter Tucker wrote:

I’d like to make a page which has a matrix of graphics each with a
caption
underneath, that my son can update without coming back to me. To
change in
FW

It’s pretty easy to link to an image as a passthrough, that he can
change,
but I’d like to do the same with text, eg calling text from a file:
pano1.txt

I thought php would be the way to go, I’ve seen includes, but don’t
know
enough about php for that to be really useful. I’ve also had a look
to see
if there are any actions but have not found anything immediately
useful.

Or is there another approach I should take?

Time to shout for the tech whizzes here!

Best wishes Peter

================================
Peter Tucker, Oxford UK email@hidden


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options