-
- 37 Posts
I have the following case:
There are a few productpages on my website (no use of ditto). My client wants to place pdf’s on those pages that can be downloaded by people who are logged in. I know it’s possible to see hidden pages after login, but i can’t figure out if it’s also possible to hide elements on pages that are also visible to everyone.
So when you go to page product 1, you can’t see the pdf.
When you log in, you go to page product 1 and you can see the pdf.
PS. is it also possible to show your last login date after you have logged in?
-
- 37 Posts
Yes i’m already using that, but i can only hide a complete page and not just 1 element (in example pdf for download) on a page. Does anyone know a solution for that?
-
- 788 Posts
Try this:
Create a Template Variable to hold the pdf image link, make sure you assign it to the template you are using.
Create a snippet with this code and call it on the page where you want the pdf link to appear, changing "Name_of_your_TV" to match the one you created.
<?php
$output ="";
if(isset($_SESSION[’webInternalKey’])){
$output .="[*Name_of_your_TV*]";
}
return $output;
?>
hope this helps
-
- 2,877 Posts
MODx equals Many Options Doing X
The PHx Plugin:
[+phx:mo=`myWebgroup`:then=`[*tv*]`:else=``+]
-
- 2,877 Posts
Breezers snippet works for me, log in as a web user! On the PHx you will need to set your webgroup name...
-
- 788 Posts
Try calling the snippet uncached on the page :
[!My_PDF_snippet
!]
Also make sure you don’t add the TV itself to the template or page content, just make sure it is assigned to the template you use. The snippet you created needs to be placed where you want the pdf link to appear on the page.
Snippets are also spelling and case sensitive, so make sure the call matches what you named it in the manager.
example: (added to template)
<html>
.../
<body>
[*content*]
[!My_PDF_snippet!]
</body>
</html>
-
- 37 Posts
Thnx Breezer, it works when i call the snippet uncached! So if anyone wants to do this trick in the future, follow the next steps:
1. Put this code in your template: [!My_PDF_snippet!]
2. Create a snippet with this code:
<?php
$output ="";
if(isset($_SESSION[’webInternalKey’])){
$output .="[*Name_of_your_TV*]";
}
return $output;
?>
3. Create a TV called "Name_of_your_TV" that show’s your pdf files and assign this to the template you want.
Now you can edit a page, on the bottom of the editor you’ll find an option to upload your files.