static html containing data from data source

hassan kalach asked on August 21, 2017 15:04

okay so i have a division that has 5 division inside of it each division has its own styling and its own html form but i need to be able to render data from 5 pages that have the same page type , i cant use repeater obviously since the 3 division will have content from all 5 pages . so guys any suggestion ?

Recent Answers


Trevor Fayas answered on August 21, 2017 15:31

Can you restate your question, it was very hard to understand. Is a division a page type, and by having "5 divisions inside" are they child pages?

If you are trying to repeat content only at a certain level, know you can use path expressions to specify exact levels of your documents, like /MyDivisions/{0}/{1} will be whatever the 3rd level object is in relation to your current path. May help, may not, need more info.

0 votesVote for this answer Mark as a Correct answer

hassan kalach answered on August 21, 2017 15:38

okay so consider this scenario you have a div ( tag) that contains 5 other div tags , you want to loop through your data source and assign some data from the first page for the first Child div tag , and some data from the second page for the second child div tag and so on . its like having a table of content and using its data buy filling the html template not repeating it . AND THANK YOU for your fast response as always.

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on August 21, 2017 15:45

Ah, Div tag = Division, got ya now.

Any reason a repeater wouldn't work in your case? Say your page structure is:

-Home
  -Page 1
  -Page 2
  -Page 3

You can have a repeater to have a path of "/Home/%" with a max relative level of 1 (so only goes down 1 level) and repeat the divs, then use the HTML Before and HTML After to set the parent div, or use a Hierarchy Repeater which then you can create this structure.

https://docs.kentico.com/k10/developing-websites/loading-and-displaying-data-on-websites/writing-transformations/using-hierarchical-transformations

0 votesVote for this answer Mark as a Correct answer

hassan kalach answered on August 21, 2017 15:53 (last edited on August 21, 2017 15:56)

yes i know the repeater does not work since i have this structure :

<div class="maindiv">

<div class="child1">
link from page 1
</div>

<div class="child2">
image from page1
image from page2   
</div>

<div class="child3">
link from page 2   
</div>

</div>

this structure should not change( and it will only appear 1 time in the website ) the content will only change depending on the page order or whatsoever , the repeater cant give me this

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on August 21, 2017 16:14

You'll have to define out your logic first, you can try instead of a repeater to use Macros since they have the current page context, or you can add multiple repeaters to cover the different structures and hide/show which one you want by setting a Macro in the Visible condition of the repeater.

I can't help much more unless it's very clear on what conditions something should render what way.

0 votesVote for this answer Mark as a Correct answer

hassan kalach answered on August 21, 2017 16:16

is there a way we can have direct message to make this easier , i appreciate your help so much

0 votesVote for this answer Mark as a Correct answer

hassan kalach answered on August 21, 2017 16:22

img, in this image you will find the design , the small white circles will display date text ( from a the page ) and the middle big circle will have 4 hidden div tags that contains data from all 4 pages , once you click on 1 of the white small circle the middle big circle will show its content inside of it

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on August 21, 2017 17:27

I get ya now! I assume that the Big Circle is the "Current Page" correct? when you click on the small white circles you go to that page and it should then become a big one?

If that is the case, you can set a separate transformation for the "Current Page Transformation" in the repeater, and have the Big circle with the image be that display, the normal transformation just be the small white dot.

If it isn't the current page, but it should be big and an image vs. small and just a white dot based on some other logic, then i would recommended use the Text/xml transformation type in your repeater and you'll have to set condition macros to display one way or the other depeneding on some logic.

http://devtrev.com/Trev-Tips-(Blog)/May-2017/Transformation-ASCX-or-Text-XML

If that still doesn't solve it, i can try to find a way to chat to help, but try using the Current page transformation.

0 votesVote for this answer Mark as a Correct answer

hassan kalach answered on August 22, 2017 07:34

hello sorry for the late reply , the middle big circle is a container that had all the content inside of it hidden once you click on any small circle the content related to that circle will be loaded inside of the big circle , and sorry for the late reply . thank you

0 votesVote for this answer Mark as a Correct answer

hassan kalach answered on August 22, 2017 11:09

okay so i managed to do this with 3 separated repeaters which in my opinion is too much for such a small section , so my question now will be if i wanted to use some data from the data base in a static html webpart how could that be possible . Example : selecting top 4 elements from a table ( database ) and in 1 html template load any data in any place i like.

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on August 22, 2017 15:40

What determines what circle is the "Big" circle with content in it? You say when they click on it, does it go to a certain url?

If you know what should trigger the content being a small white dot vs. a bit circle, you can use a single transformation with macro logic to say "style as small white dot or big circle"

0 votesVote for this answer Mark as a Correct answer

hassan kalach answered on August 22, 2017 16:17

the point is i dont what to change the style of the big or small circle they are all static i will always have 2 small circle then 1 big circle and the 2 small circle , the point was that the big circle will contains all the info about all 4 small circles and they are all hidden , once you click on a certain small circle the info related to here inside the big circle will show up ( img text date etc..)

0 votesVote for this answer Mark as a Correct answer

hassan kalach answered on August 22, 2017 16:19

and in the same time all the data and stuff will be related to certain page types

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on August 22, 2017 19:21

Okay, then is it possible to just use either a webpart container or the HTML before / After on the central repeater? So the first 2 dots are in the Before, the last 2 dots are the after, and the repeater will repeat through your certain page types and render as you need them?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.