Jump to content


ShowDoc


  • You cannot reply to this topic
11 replies to this topic

#1 VTX

    Etomite Forum Newbie

  • Member
  • 17 posts

Posted 09 November 2004 - 09:06 AM

I have added a new snippet to the Snippet Library!

Snippet name: ShowDoc
Author: VTX
Version: 1.0 (Final)
More info: View this snippet
Description:
Very simple snippet that shows any document on any place. Usefull for example left or right colom content or footers etc.

Please feel free to comment on this snippet, suggest improvements, or simply praise my work! ;)

[This is an automatically created message]

#2 SpeedStreet

    Etomite Forum Fan

  • Member
  • Pip
  • 55 posts

Posted 09 November 2004 - 04:18 PM

VTX, on Nov 9 2004, 03:06 AM, said:

I have added a new snippet to the Snippet Library!

Snippet name: ShowDoc
Author: VTX
Version: 1.0 (Final)
More info: <a href="http://www.etomite.com/browsesnippets.html?int_snipid=27">View this snippet</a>
Description:
Very simple snippet that shows any document on any place. Usefull for example left or right colom content or footers etc.

Please feel free to comment on this snippet, suggest improvements, or simply praise my work! ;)

[This is an automatically created message]

Could you please provide a screenshot?

#3 VTX

    Etomite Forum Newbie

  • Member
  • 17 posts

Posted 09 November 2004 - 06:19 PM

SpeedStreet, on Nov 9 2004, 05:18 PM, said:

Could you please provide a screenshot?

You can have a look at: http://www.ilimburg.nl/~buchele/

This site is still under construction, but the ShowDoc script is used to display the content in the left column, and the content in the footer.

#4 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 15 December 2004 - 04:55 PM

This is a handy snippet. You could let Etomite do more of the heavy lifting (using the API) and reduce it down to:

//                              
// Snippet: Showdoc by VTX
//                              
// Usage: [[ShowDoc?id=x]]      
// x = the document to show     
//                                

$output = '';
$docInfo = $etomite->getDocument($id);
$output .= $docInfo['content'];
return $output;


#5 Guest_eko40_*

  • Guests

Posted 15 December 2004 - 08:47 PM

Jared, wonderful piece of coding efficiency!

#6 Guest_rthrash_*

  • Guests

Posted 22 December 2004 - 04:29 PM

How would this work to show the entire page, not just the contents of the "content" variable. Better use of the wrapper snippet?

#7 Guest_rthrash_*

  • Guests

Posted 22 December 2004 - 04:37 PM

Let me clarify a bit... it's not showing the parts of the page that use the DocVars I've got set up.

It seems this only shows the portions in the [*content*] variable. I am trying to access the entire page as it would be parsed through the parser, including all the template information.

#8 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 22 December 2004 - 05:16 PM

rthrash, on Dec 22 2004, 11:37 AM, said:

Let me clarify a bit... it's not showing the parts of the page that use the DocVars I've got set up.

It seems this only shows the portions in the [*content*] variable. I am trying to access the entire page as it would be parsed through the parser, including all the template information.
I don't use DocVars so I'm really not sure how this would be processed. Any guess I would have would be just that; a guess. A far out guess might be to up the number of times the page gets parsed...? Could it be a simple matter of just running out of parse passes? (Say that 10 times fast :lol:)

#9 Guest_rthrash_*

  • Guests

Posted 22 December 2004 - 05:23 PM

And the solution is to add the getDocVars API addition as follows:

// Usage: [[portfolio?id=x]]      
// x = the document to show, NOT wrapped in [~~]

$output = '';

$docInfo = $etomite->getDocument($id);
$docVarsInfo = $etomite->getDocVars($id);
$docImage = $docInfo['content'];
$docTitle = $docVarsInfo['imagetitle'];
$docDescription = $docVarsInfo['imagedesc'];

$output = <<<EOD

<div class="portfolioSection">
    <div class="portImg">$docImage</div>
    <p class="portTitle">$docTitle</p>
    <p>$docDescription</p>
</div>

EOD;

return $output;

:D Thanks for forcing me to go pokin' around in the main index file... some other interesting stuff in there methinks! ;)

update: minor rev to the way it builds the output to eliminate having to escape quotes

#10 katherholt

    Likes Etomite Forums!

  • Member
  • PipPip
  • 323 posts

Posted 18 March 2005 - 06:09 PM

Is it possible to use this snippet to show "content" of a document on 2 different sites/databases?

For example:

http://www.tourmcdonough.com/index.php?id=17
http://www.visitmetroatlanta.com/index.php?id=58

Both sites use the same exact content. Is it possible to use one of the files to keep in sync and only update the one file? This situation comes up frequently for me.

#11 gtatler

    Likes Etomite Forums!

  • Member
  • PipPip
  • 338 posts

Posted 12 June 2005 - 08:49 PM

I love this little snippet.

Most useful for adding bits and peices of information to a site.

Just one question.

Is it possible to build in a test to ensure that a document is published ?

#12 bwoodsdesign

    Likes Etomite Forums!

  • Member
  • PipPip
  • 236 posts

Posted 27 August 2008 - 01:41 AM

This is my all-time favorite snippet!

Even after all these years, and upgrades to different versions of Etomite, I come here to snag it all the time!

Every new client site I develop uses this snippet, more than all others.

Great job :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users