News page with 'see more' URL link from summary copy

General discussions about WebYep
Post Reply
chassa2556
Posts: 8
Joined: Thu May 14, 2009 11:04 am

News page with 'see more' URL link from summary copy

Post by chassa2556 » Thu May 14, 2009 12:06 pm

I would like to do a loop that did something like this from within Dreamweaaver CS4.

News story One (title)
Lorum ipsum fortis est this is summary copy lorum ipsum (short text with summary story)
See more (This would link to a full detail page with more information for story 1)
________________________________

News story Two
(title)
Lorum ipsum fortis est this is summary copy lorum ipsum (short text with summary story)
See more (This would link to a full detail page with more information for story 2)

Could you please give me the correct code that would make this work?

johannes
Objective Development
Objective Development
Posts: 815
Joined: Fri Nov 10, 2006 4:39 pm
Contact:

Re: News page with 'see more' URL link from summary copy

Post by johannes » Tue May 19, 2009 11:37 am

You would need to construct a loop using the WebYep Loop Element. The "See more" link would need to use a little PHP code:

Code: Select all

<a href="news_detail_page.php?WEBYEP_DI=<?php echo $webyep_oCurrentLoop>iCurrentLoopID()?>">See more</a>

chassa2556
Posts: 8
Joined: Thu May 14, 2009 11:04 am

Re: News page with 'see more' URL link from summary copy

Post by chassa2556 » Mon Jun 15, 2009 6:52 pm

I've followed your link suggestion but its coming up with a blank page and isn't drawing correctly

http://www.homeopathyforhealthinafrica.org/news.php

Its not including the lock at the bottom of the page and not giving me my fields. I'm simply wanting to have a page of summary news events summary lead in body copy with a see more for the full feature. "news_detail_page.php"

Could you please tell me what I'm doing wrong?

Code: Select all

   
<h1>News page summaries<?php webyep_shortText("Page Title", false); // WebYepV1 ?>
        </h1>
        <p>
          <?php foreach (WYLoopElement::aLoopIDs("Loopname") as $webyep_oCurrentLoop->iLoopID) { $webyep_oCurrentLoop->loopStart(true); // WebYepV1 ?>
      <br />
      <strong><?php webyep_shortText("Name", false); // WebYepV1 ?></strong>
      <?php webyep_richText("Fieldname", false, "", true); // WebYepV1 ?>
      <a href="news_detail_page.php?WEBYEP_DI=<?php echo $webyep_oCurrentLoop>iCurrentLoopID()?>">See more</a>
       <?php $webyep_oCurrentLoop->loopEnd(); } // WebYepV1 ?>

johannes
Objective Development
Objective Development
Posts: 815
Joined: Fri Nov 10, 2006 4:39 pm
Contact:

Re: News page with 'see more' URL link from summary copy

Post by johannes » Thu Jun 18, 2009 3:40 pm

There's a syntax error in your code:

Code: Select all

$webyep_oCurrentLoop>iCurrentLoopID()

should read

Code: Select all

$webyep_oCurrentLoop->iCurrentLoopID()

(the "-" is missing) - or even better (as "$webyep_oCurrentLoop->..." is deprecated)

Code: Select all

WYLoopElement::iCurrentLoopID()


But currently your page shows up fine - you seem to have chosen a different approach now (with the link anchors "#" instead of WebYep document instances).

Is this now solved for you?

chassa2556
Posts: 8
Joined: Thu May 14, 2009 11:04 am

Re: News page with 'see more' URL link from summary copy

Post by chassa2556 » Tue Jun 23, 2009 4:18 pm

yes I think I'm there - many thanks

evolvedix69
Posts: 1
Joined: Mon Aug 10, 2009 9:36 am

Re: News page with 'see more' URL link from summary copy

Post by evolvedix69 » Mon Aug 10, 2009 9:38 am

I've followed your hotlink advancement but its advancing up with a bare page and isn't cartoon correctly..


_________________
offshore staffing solutions

johannes
Objective Development
Objective Development
Posts: 815
Joined: Fri Nov 10, 2006 4:39 pm
Contact:

Re: News page with 'see more' URL link from summary copy

Post by johannes » Tue Aug 11, 2009 11:05 am

I'm sorry - I do not get your meaning - please elaborate.

testing1
Rank 1
Rank 1
Posts: 23
Joined: Tue Oct 13, 2009 5:25 pm

Re: News page with 'see more' URL link from summary copy

Post by testing1 » Thu Jan 14, 2010 4:01 pm

Hello Johannes,

I've been using this script for news and it works well.

Code: Select all

<a href="news_detail_page.php?WEBYEP_DI=<?php echo $webyep_oCurrentLoop>iCurrentLoopID()?>">See more</a>


The section that reads ">See more<"; could that be made completely customizable? I find it very useful to to change that to: "Read more, extra…, keep reading or the complete name of the article I reference".

Is this is possible? Thanks.

My clients are loving this product :D .

johannes
Objective Development
Objective Development
Posts: 815
Joined: Fri Nov 10, 2006 4:39 pm
Contact:

Re: News page with 'see more' URL link from summary copy

Post by johannes » Mon Jan 18, 2010 12:15 pm

That is possible.

But you cannot make a link's content editable directly. In edit mode an editable content contains the edit button - which itself is a link. You would end up with a link inside a link...

But you can do this:

Code: Select all

<?php if (webyep_bIsEditMode()) { echo "(Link Text: "; webyep_shortText("LinkText", false); echo ")&nbsp;"; } ?><a href="news_detail_page.php?WEBYEP_DI=<?=$webyep_oCurrentLoop->iCurrentLoopID()?>"><?php echo webyep_sShortTextContent("LinkText", false); ?></a>


That way the Short Text Element's content is used as the link text, but that text is edited not inside the link but left to it - that editable text on the left is only displayed in edit mode.

testing1
Rank 1
Rank 1
Posts: 23
Joined: Tue Oct 13, 2009 5:25 pm

Re: News page with 'see more' URL link from summary copy

Post by testing1 » Thu Dec 09, 2010 8:57 pm

Hi Johannes!

I'm back again with another challenge. I've been using this beautiful piece of code in combination with the loop element and it works great.

Is it possible to have this code:

Code: Select all

<?php if (webyep_bIsEditMode()) { echo "(Link Text: "; webyep_shortText("LinkText", false); echo ")&nbsp;"; } ?><a href="news_detail_page.php?WEBYEP_DI=<?=$webyep_oCurrentLoop->iCurrentLoopID()?>"><?php echo webyep_sShortTextContent("LinkText", false); ?></a>

used for three different sections in a single page? My sections are Residential, Commercial and Custom Projects. Currently, when I duplicate the code three times, it repeats the same link I created, three times… I tried editing "LinkText" to "LinkText1,2,3…etc, but did not work.

Do you have any suggestions that enhance the code so I can apply it to three independent sections within a single page?
Thank you for your time.

8)

marcus
Objective Development
Objective Development
Posts: 170
Joined: Tue Nov 30, 2010 1:25 pm

Re: News page with 'see more' URL link from summary copy

Post by marcus » Mon Dec 13, 2010 4:49 pm

testing1 wrote:Do you have any suggestions that enhance the code so I can apply it to three independent sections within a single page?

Not only do we have a suggestion, but an actual solution:

Code: Select all

<?php foreach (WYLoopElement::aLoopIDs("LoopName1") as $webyep_oCurrentLoop->iLoopID) { $webyep_oCurrentLoop->loopStart(true); ?>
<?php if (webyep_bIsEditMode()) { echo "(Link Text: "; webyep_shortText("LinkText1", false); echo ")"; } ?>
<a href="detail_page1.php?DOC_INST=<?=$goApp->oDocument->iDocumentInstanceForLoopID($goApp->oDocument->iLoopID())?>"><?php echo webyep_sShortTextContent("LinkText1", false); ?></a>
<?php $webyep_oCurrentLoop->loopEnd(); } ?>

... more content ...

<?php foreach (WYLoopElement::aLoopIDs("LoopName2") as $webyep_oCurrentLoop->iLoopID) { $webyep_oCurrentLoop->loopStart(true); ?>
<?php if (webyep_bIsEditMode()) { echo "(Link Text: "; webyep_shortText("LinkText2", false); echo ")"; } ?>
<a href="detail_page2.php?DOC_INST=<?=$goApp->oDocument->iDocumentInstanceForLoopID($goApp->oDocument->iLoopID())?>"><?php echo webyep_sShortTextContent("LinkText2", false); ?></a>
<?php $webyep_oCurrentLoop->loopEnd(); } ?>

... more content ...

<?php foreach (WYLoopElement::aLoopIDs("LoopName3") as $webyep_oCurrentLoop->iLoopID) { $webyep_oCurrentLoop->loopStart(true); ?>
<?php if (webyep_bIsEditMode()) { echo "(Link Text: "; webyep_shortText("LinkText3", false); echo ")"; } ?>
<a href="detail_page3.php?DOC_INST=<?=$goApp->oDocument->iDocumentInstanceForLoopID($goApp->oDocument->iLoopID())?>"><?php echo webyep_sShortTextContent("LinkText3", false); ?></a>
<?php $webyep_oCurrentLoop->loopEnd(); } ?>

would do exactly what you want.

Lets look at this in detail:
Basically, the 3 blocks are the same, except for the field names and the target pages.

Here is a generic block, that you could use as often as you like on a single page. Changes to every single block are marked in red, resp. dark red (you must change those for every block you create! Note, that the loop name has nothing to do with the link text and target - they are completely independent). Customizable labels are shown in blue (you may change those, to whatever you like - even arbitrary HTML):

Line 1 is just an ordinary loop start
<?php foreach (WYLoopElement::aLoopIDs("LoopNameY") as $webyep_oCurrentLoop->iLoopID) { $webyep_oCurrentLoop->loopStart(true); ?>

Line 2 displays the ShortText element (wrapped by the text in blue) if we're in edit mode
<?php if (webyep_bIsEditMode()) { echo "(Link Text: "; webyep_shortText("LinkTextX", false); echo ")"; } ?>

Line 3 defines a link to another page and gives it a unique DocID. It also displays the content of the previously defined ShortText element as the link's text
<a href="detail_pageX.php?DOC_INST=<?=$goApp->oDocument->iDocumentInstanceForLoopID($goApp->oDocument->iLoopID())?>"><?php echo webyep_sShortTextContent("LinkTextX", false); ?></a>

Line 4 closes the loop
<?php $webyep_oCurrentLoop->loopEnd(); } ?>


3 things are important, to have as many such blocks as you like in your page:
  1. Each loop has to have a unique name.
  2. Each ShortText element must have a unique name per loop. So "LinkTextX" must be the same within one loop on lines 2 and 3.
    The reason for this is, that line 2 defines the actual ShortText element, which is only shown in edit mode, while line 3 uses an API call to display the current content of this element, whether we're in edit mode or not.
  3. Each detail page should have a separate .php file for display. You could use a single page for this, but it would complicate matters a lot.

As for the naming convention, I used numbers in the code block above, to illustrate differences between each block. You can of course use any valid and meaningful name for the WebWep elements or the target pages. In your case "LoopResidential", "LoopCommercial" and "LoopCustomProjects" would be perfectly fine (and easier to read once this is finished ;)). Same goes true for the ShortText element and the target pages.

testing1
Rank 1
Rank 1
Posts: 23
Joined: Tue Oct 13, 2009 5:25 pm

Re: News page with 'see more' URL link from summary copy

Post by testing1 » Wed Dec 22, 2010 8:08 pm

It worked beautifully! Check it out http://johnnyonthespotservices.com/featured-projects.php
:D
-edited the url, to reflect move

hezex
Posts: 1
Joined: Wed Dec 19, 2018 9:31 am

Re: News page with 'see more' URL link from summary copy

Post by hezex » Wed Dec 19, 2018 9:31 am

View of the topic is challenged and introduced for the humans. The factor of the program and dissertation writing services uk has been identified for the injection for the people. The sorting is done for the interest of the talented and such individuals.

Post Reply