List Info

Thread: A couple of questions




A couple of questions
user name
2007-06-19 10:22:20
All,
Hello...

1. I'm trying to figure out how to get the last story
published as a
link in the current story.. Is anyone doing this?


2. I've been looking for a tutorial or a reference to change
the
actions of a document.

I have some stories that I would like to span 2 pages..
index.html and
indexX.html.

I would like to have 2 - 3 paragraphs to land in index.html
and the
rest to land in indexX.html...

Does anyone have an example of this..?
I foresee the need of a check box as the indicator to split
docs into 2 pages...
outside of that I can't seem to figure it out...

Thanks in advance..

Chauncey Thorn
Systems Administrator/PHP Application Developer.
chauncey.thorngmail.com

Re: A couple of questions
user name
2007-06-19 11:00:59
On Tue, 19 Jun 2007, Chauncey Thorn wrote:
> 1. I'm trying to figure out how to get the last story
published as a
> link in the current story.. Is anyone doing this?

You can probably get the last published story with
(untested)
my ($last_pubbed) =
Bric::Biz::Asset::Business::Story->list({
     'Order' => 'publish_date',
     'Limit' => '1',
});

> 2. I've been looking for a tutorial or a reference to
change the
> actions of a document.

I don't know what that means.

> I have some stories that I would like to span 2 pages..
index.html and
> indexX.html.
>
> I would like to have 2 - 3 paragraphs to land in
index.html and the
> rest to land in indexX.html...

You mean, a multipage story?
Add two Page elements to a story, put paragraph fields in
each.
Normally the 2nd page will be called 'index2.html', not
'indexX.html'.

> Does anyone have an example of this..?
> I foresee the need of a check box as the indicator to
split docs into
> 2 pages...
> outside of that I can't seem to figure it out...

Do you mean from a template? That would be
more complicated.. From the top-level $element,
you'd have to do some element manipulation with
the methods in
http://bricolage.cc/docs/current/api/?Bric::B
iz::Element::Container
and
http://bricolage.cc/docs/current/api/?Bric::Biz::
Element::Field

Re: A couple of questions
user name
2007-06-19 11:09:33
On Tue, 19 Jun 2007, Scott Lanning wrote:
> You can probably get the last published story with
(untested)
> my ($last_pubbed) =
Bric::Biz::Asset::Business::Story->list({
>    'Order' => 'publish_date',
>    'Limit' => '1',

       # forgot this
      'OrderDirection' => 'DESC',
> });

Re: A couple of questions
user name
2007-06-19 11:58:36
On Jun 19, 2007, at 09:00, Scott Lanning wrote:

> You mean, a multipage story?
> Add two Page elements to a story, put paragraph fields
in each.
> Normally the 2nd page will be called 'index2.html', not
'indexX.html'.

Actually it would be index1.html. index2.html is page 3.
Don't ask.

Best,

David

Re: A couple of questions
user name
2007-06-20 12:33:30
THanks...

On 6/19/07, Scott Lanning <lanningswho.int> wrote:
> On Tue, 19 Jun 2007, Chauncey Thorn wrote:
> > 1. I'm trying to figure out how to get the last
story published as a
> > link in the current story.. Is anyone doing this?
>
> You can probably get the last published story with
(untested)
> my ($last_pubbed) =
Bric::Biz::Asset::Business::Story->list({
>     'Order' => 'publish_date',
>     'Limit' => '1',
> });
    Thanks will test...

>
> > 2. I've been looking for a tutorial or a reference
to change the
> > actions of a document.
>
> I don't know what that means.
  You answered it or provided the needed pointer...

>
> > I have some stories that I would like to span 2
pages.. index.html and
> > indexX.html.
> >
> > I would like to have 2 - 3 paragraphs to land in
index.html and the
> > rest to land in indexX.html...
>
> You mean, a multipage story?
    exactly what I was attempting to ask. :+)

> Add two Page elements to a story, put paragraph fields
in each.
> Normally the 2nd page will be called 'index2.html', not
'indexX.html'.
>
> > Does anyone have an example of this..?
> > I foresee the need of a check box as the indicator
to split docs into
> > 2 pages...
> > outside of that I can't seem to figure it out...
>
> Do you mean from a template? That would be
> more complicated.. From the top-level $element,
> you'd have to do some element manipulation with
> the methods in
> http://bricolage.cc/docs/current/api/?Bric::B
iz::Element::Container
> and
> http://bricolage.cc/docs/current/api/?Bric::Biz::
Element::Field
>

if all I need to do is add another page element. I think I
have a solution..

Re: A couple of questions
user name
2007-06-20 13:24:19
This URL seems to make reference to how to create the
index.html,
index1.html etc..
http://www.masonbook.com/book/appendix-d.mhtml#APP-D-F
IG-7


First I create a subelement Page.. and added just a
Paragraph to the subelement.
Made the new subelement a element of my article page...

Modifiy my article template - adding the code below in the
<snip>

Got this error:

<error>
An error occurred while processing your request:

Unable to find template 'page.mc'

Location of the error:
Article -> Page[8]

Please report this error to your administrator.
</error>

Do I really need page.mc if I posted the code to my Article
templage...


<snip>
 <%perl>;
  # Display all elements except 'prev' and 'next'.
  foreach my $e ($element->get_elements) {
      next if $e->has_name('prev') ||
$e->has_name('next');
      if ($e->has_name('paragraph')) {
          $m->print('<p>'. $e->get_data .
"</p>n");
      } else {
          $burner->display_element($e);
      }
  }

  $m->print("n<hr />nn");

  # Get file name info from the output channel.
  my $oc = $burner->get_oc;
  my $filename = $oc->get_filename;
  my $file_ext = $oc->get_file_ext;

  # $burner numbers pages from '0' not '1'.
  my $pnum = $burner->get_page + 1;

  # Show 'previous' link
  if (my $prev = $element->get_data('previous')) {
      my $pageindex = $pnum-2 != 0 ? $pnum-2 : '';
      my $prev_pnum = $pnum - 1;
      $m->print(qq{<p><a
href="$filename$pageindex.$file_ext">}
                . qq{&lt;-- $prev
$prev_pnum</a></p>});
  }

  # Show 'next' link
  if (my $next = $element->get_data('next')) {
      $m->print(qq{<p><a
href="$filename$pnum.$file_ext">}
                . qq{$next --></a></p>});
  }
  </%perl>

</snip>

THanks..
Sorry for being clueless...


On 6/19/07, David E. Wheeler <davidkineticode.com> wrote:
> On Jun 19, 2007, at 09:00, Scott Lanning wrote:
>
> > You mean, a multipage story?
> > Add two Page elements to a story, put paragraph
fields in each.
> > Normally the 2nd page will be called
'index2.html', not 'indexX.html'.
>
> Actually it would be index1.html. index2.html is page
3. Don't ask.
>
> Best,
>
> David
>

Re: A couple of questions
user name
2007-06-21 03:24:28
On Wed, 20 Jun 2007, Chauncey Thorn wrote:
> First I create a subelement Page.. and added just a
Paragraph to the 
> subelement.
> Made the new subelement a element of my article
page...

I assume you mean an article element here, not a page
element.

> Modifiy my article template - adding the code below in
the <snip>
>
> Got this error:
>
> <error>
> An error occurred while processing your request:
>
> Unable to find template 'page.mc'
>
> Location of the error:
> Article -> Page[8]
>
> Please report this error to your administrator.
> </error>
>
> Do I really need page.mc if I posted the code to my
Article templage...

Just make an empty one if you don't want to do anything in
it.
Maybe Bricolage should just skip those instead.

> <snip>
> <%perl>;
> # Display all elements except 'prev' and 'next'.
> foreach my $e ($element->get_elements) {
>     next if $e->has_name('prev') ||
$e->has_name('next');
>     if ($e->has_name('paragraph')) {
>         $m->print('<p>'. $e->get_data .
"</p>n");
>     } else {
>         $burner->display_element($e);

You're looping over all elements, right?
So one of those elements is going to be a Page element,
which is what $burner->display_element is going to
display.
(Though I don't understand the location in the error
message
"Article -> Page[8]". Why page 8?)

[1-7]

about | contact  Other archives ( Real Estate discussion Medical topics )