How to use image tags or variables in a news story.

Discuss news styles, css code, and other Coranto customizations in here...the possibilities are endless, so have at it!

Moderator: Spunkmeyer

Postby Esstee » Sat Jun 11, 2005 1:35 am

thanks Lumberjack that worked.

I pretty much have a working setup using this scripting approach and
image placement method, although I just learned that Coranto does
not like static placement of tables in input fields!

I tried to create a Caption system where the image would be placed in
a simple table with a dynamic lower character region for caption text but
the moment I placed this in the story Coranto would go haywire and the
only way I could fix it was to restore from a backup "weird"

I wonder how else I could create image captions?
although its not absolutely necessary at this time, it is an important part
of writing technical documents with illustrations.
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Esstee » Sat Jun 11, 2005 3:52 am

FieldIncluder

that solved it. thx for your help
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Lumberjack » Sat Jun 11, 2005 2:37 pm

That's good news (haha a pun!) so perhaps you might like to write a tutorial on how to do this, for any poor unsuspecting souls who follow you? It could go in the 'How To' section, which could use a bit of filling out now I think.
Lumberjack
 
Posts: 555
Joined: Wed Jan 10, 2007 7:22 pm
Location: Oxford, UK

Postby Esstee » Sat Jun 11, 2005 3:00 pm

Lumberjack

I am way ahead of you :D
I decided to document and write up guides for every feature I use in my
newsroom (and thats alot).

The I will publish the document and polish it up with an index etc. for all
the poor unsuspecting souls out there who pass through the same needle
hole most of us have when we all started out.

I am still struggling with it all myself but that won't stop me from sharing
my experiences with others

:P
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby SrNupsen » Sun Jun 12, 2005 11:24 pm

Great news!

SrNupsen
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby Esstee » Thu Jun 16, 2005 3:42 pm

Well I hit a brick wall with my approach on this matter and I hope someone
can help me :(

When it comes to posting news through vBcomment none of the images are
rendered because the addon doesn't seem to process the field includer
data.

I tried creating a profile and using a php include function in a style wich does
work but vBulletin won't process it within a forum thread I guess that would
create a monster security problem if it did.

Anyways I am at a stand still now.

Could someone help me create a snippet of code that could process
the <multipart fields> into a variable so that when I type
[img1] or whatever in my news story it would = the actual path?
if this was possible then the image paths would be in plain html text
and usable in my vbulletin post.

otherwise I am stuck omitting the images :(
Your generous assitance is appreciated as always 8)
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Esstee » Thu Jun 16, 2005 7:47 pm

I have been doing some experimenting and it would seem that most of
the problems surround the fact that multipart does not seem to process
or render the <multipart CustomField_Text_image> in the style like other
fields, at this stage I don't quite know if this is happening due to a setting
somewheres or this is how the addon does things.

furthermore I wonder if there is a way around it.
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Parahead » Fri Jun 17, 2005 3:30 pm

Esstee wrote:Could someone help me create a snippet of code that could process
the <multipart fields> into a variable so that when I type
[img1] or whatever in my news story it would = the actual path?
if this was possible then the image paths would be in plain html text
and usable in my vbulletin post.
Isn't this an old topic we have discussed before? I have also previously given you links to threads where I replaced a BBCode like [quote] tag, that could be used as a base for this...

Esstee wrote:I have been doing some experimenting and it would seem that most of
the problems surround the fact that multipart does not seem to process
or render the <multipart CustomField_Text_image> in the style like other
fields, at this stage I don't quite know if this is happening due to a setting
somewheres or this is how the addon does things.
In a style you can use <FilePath: CustomField_X> (as described in the documentation!) to get the path to the file you have uploaded. Isn't that what you want to do?
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Esstee » Fri Jun 17, 2005 4:05 pm

Isn't this an old topic we have discussed before? I have also previously given you links to threads where I replaced a BBCode like
tag, that could be used as a base for this...


Parahead I looked high and low for that thread I knew it was here
somewheres but I think it was not the primary discussion and so its not
apparent.

In a style you can use <FilePath: CustomField_X> (as described in the documentation!) to get the path to the file you have uploaded. Isn't that what you want to do?


I had no idea of this feature, I will tru ASAP and see how that one works out.
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Esstee » Fri Jun 17, 2005 4:35 pm

Okay I tried using <FilePath: CustomField_Text_image1> and that tag is
not rendered in the Text field instead, it remains just as it is written here
<FilePath: CustomField_Text_image1> in the published news story.

I am currently using anne rice and field includer to convince Coranto to
process multipart image paths in the Text field but I think I'm taking things
to far out of context to try and reach my goal and the results are becoming
more and more unpredicable.

It would seem that the only way to publish images using tags would be
with some sort of perl scripting where I could get the paths resolved and
converted to plain html in the published article.

You did give me a bit of code at some point but I was not able to make it
work here is that code:

Esstee wrote:
Code: Select all
/web/imgdir/misc/test.jpg


instead of

Code: Select all
http://www.mysite.com/web/imgdir/test.jpg


because my thumbnail script looses performance when it goes out with a
http path vs. an internal one.

The script I'm using is this one:

Code: Select all
Code:
<PerlCode>
$MP_FieldName = "CustomField_Text_image1";
$Text =~ s!\[img1\]!'<IMG SRC="' . $fieldDB{$MP_FieldName}->{http} . '/' . ${$MP_FieldName} . '">'!ge;
</PerlCode>

I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Parahead » Fri Jun 17, 2005 4:59 pm

Esstee wrote:Okay I tried using <FilePath: CustomField_Text_image1> and that tag is
not rendered in the Text field instead, it remains just as it is written here
<FilePath: CustomField_Text_image1> in the published news story.
That is strange, are you using it just like that in the style? Not through some Anne Rice replacement thing?

Esstee wrote:I am currently using anne rice and field includer to convince Coranto to
process multipart image paths in the Text field but I think I'm taking things
to far out of context to try and reach my goal and the results are becoming
more and more unpredicable.
And for anyone to understand how you have things set up in order to help you... ;-)

Code: Select all
<PerlCode>
$MP_FieldName = "CustomField_Text_image1";
$Text =~ s!\[img1\]!'<IMG SRC="' . $fieldDB{$MP_FieldName}->{http} . '/' . ${$MP_FieldName} . '">'!ge;
</PerlCode>

I think it was LumberJack actually... Anyway, "not working" is not much to go on, what is the output from it, what happens, more details please?
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Esstee » Fri Jun 17, 2005 5:13 pm

LJ showed this code:
You should probably do something like
Code: Select all
$Text =~ s{http://www.mysite.com}{};


<PerlCode>
$img1 =~ s{/imgs/misc/}{<Field: CustomField_Text_image1>};
</PerlCode>

$img1

I tried this in my style it didn't work, but you might get my idea
and spot how to do it?
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Lumberjack » Fri Jun 17, 2005 5:15 pm

Ah yes the mistake there is using <Field: CustomField_Text_image1> as basically during translation into perl (StyletoPerl subroutine) that is replaced with $CustomField_Text_image1. So really there you should just put the perl equivalent $CustomField_Text_image1 (as you are inside <PerlCode> tags which means you are writing in pure perl).
Lumberjack
 
Posts: 555
Joined: Wed Jan 10, 2007 7:22 pm
Location: Oxford, UK

Postby Esstee » Fri Jun 17, 2005 5:24 pm

okay so now I have this:
Code: Select all
<PerlCode>
$img1 =~ s{/imgs/misc/}{$Field: CustomField_Text_image1};
</PerlCode>


but putting $img1 in my Text field doesnt produce anything
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Lumberjack » Fri Jun 17, 2005 5:27 pm

Ok... quick tutorial:
In raw perl, the variable is called $img1. This is how it can be used in raw perl... to test this, you could try:
Code: Select all
<PerlCode>$newshtml .= $img1;</PerlCode>

and that should work.
Coranto has a method of keeping these things friendly for the user, and so instead of having $img1, we use <Field: img1> and replace it afterwards.
So if you are inside PerlCode tags, you must use raw perl, but outside you should use style tags.

This is what you need:
Code: Select all
<PerlCode>
$img1 =~ s{/imgs/misc/}{$CustomField_Text_image1};
</PerlCode>

<Field: img1>

Note the variable name in the substitution there!
Lumberjack
 
Posts: 555
Joined: Wed Jan 10, 2007 7:22 pm
Location: Oxford, UK

PreviousNext

Return to Customization

Who is online

Users browsing this forum: No registered users and 1 guest

cron