I have put paragraphs of text into my mongo database using a mongoose schema. It is a lot of text and it just comes out as one giant block of text on my site page. I have tried including html into the paragraphs but it shows the html and remains as one giant blob of text.
My question is: how do I store paragraphs of text in my database and display them as separate paragraphs? Many thanks in advance.
name: 'Superstar Road Bike',
mainImage: '/public/img/Bikes/Road/Superstar Disc/Superstar.jpeg',
gallery: [ '/public/img/Bikes/Road/Superstar Disc/superstar bottom bracket.jpeg'
, '/public/img/Bikes/Road/Superstar Disc/superstar rear.jpeg'
, '/public/img/Bikes/Road/Superstar Disc/superstar front end.jpeg'
],
description: '<p>Superstar reinterprets at the highest degree of.</p>in carbon fiber, the legendary Italian competition bicycle on the track, the Cinelli that embodies the brands heritage and DNA.Unlike other brands that every year offer bicycles with an increasingly reduced use destination, Cinelli developed Superstar with a meticulous attention to how the intrinsic qualities of carbon fiber and the production processes could be used to create a tremendous edition contemporary of the legendary Italian Grand Tour quality in the saddle: an intelligent balance of lightness, perfect maneuverability on any surface and comfort over long distances.',
price: 39999,
salePrice: 400,
Here is how I am displaying it in my EJS file:
<div id="itemParagraph">
<p> <%= bike.description %> </p>
</div>
<div id="colorSeparator"></div>
Related
Im getting Map is not a function in arrays inside Objects in React,
Here is my code:
export const detailProduct = [
{
sku: "price_1HCCiwLjQjzuYZ7H4KhpEqLX",
title: "Tibetan Singing Bowl Set",
price: 29.99,
info: "Tibetan Singing Bowl Set Meditation Bowl",
madeInfo: "3.2 Handmade Meditation Bowl x 1, Hand- sewn Silk Cushion x 1, Mallet covered with leather x 1, creamy white storage bag x 1.A full set of Tibetan Meditation Yoga Singing Bowl with decent price. Our singing bowl can fit in your hand, portable and perfect for on - the - go requirements. CRAFTSMANSHIP - Hand hammered by the craftsmen specializing in Meditation Yoga Singing Bowls.Well - carved symbols and vivid patterns revealed the wholehearted process.Specially hand - sewn silk cushion highlighted the quality of the singing bowl set.",
typeInfo: "PREMIUM QUALITY - Adopting traditional Nepalese craft, made up of seven metals including gold, silver, mercury, copper, iron, tin and lead.",
moreInfo: "EASY TO USE - You can gently tap the mallet to the outside and inside edges of the meditation bowl or play it around the rim to produce the resonant sounds and deep vibrations that can relax your mind and release stress. WIDE APPLICATIONS - Great choice for yoga meditation, sound therapy, spiritual gatherings and stress relief. Ideal for healing from stress disorders, pain, depression and excessive lust. Perfect gifts for your friends, families and sweetheart.",
inCart: false,
images: [
{
url: "/singingbowl2999/1.png"
},
{
url: "/singingbowl2999/2.png"
}
]
}
]
I am having trouble looping over Images array. I get map is not a function. Please help
try doing
detailProduct[0].images.map(image => {
// do what you want in here.
})
My best guess is that you forgot to specify the index in the detailProduct array.
The images you want to access are a part of the object which is at index 0 in the detailProduct array.
Try the following:
detailProduct[0].images.map((image, index) => {
<img key={index} src={require(image.url)} />
})
thank you all I got it. I was doing some tutorial and wanted add extra images. I got it.
I would like for this map method to create one list item for each string but it is bunching them all together.
This is what my output looks like
-Plan and execute content marketing efforts globally to attract, engage and retain high value customersExecute content expansion efforts including incremental content-focused emails, website placements, etc.Coordinate content distribution, digital and social marketing efforts for the Ideas Center and other content related-effortsLead internal writer for new product launch for BizBox powered by Office Depot. Partnered with PWC to produce Beta site
{
id: '2',
position: 'Marketing Lead, High Value Customers & Businesses, Global E-commerce',
tenure: ' 4/17 – 8/17',
duties:['Plan and execute content marketing efforts globally to attract, engage and retain high value customers','Execute content expansion efforts including incremental content-focused emails, website placements, etc.','Coordinate content distribution, digital and social marketing efforts for the Ideas Center and other content related-efforts','Lead internal writer for new product launch for BizBox powered by Office Depot. Partnered with PWC to produce Beta site']
},
{resume.map(resume => {
return <ExperienceCompany id={resume.id} company={resume.company} location={resume.location} tenure={resume.tenure} duties={resume.duties}/>
})}
{props.duties.map(resume => {
return <li id={props.id}>{props.duties}</li>
})}
Hard to tell with the limited context, but you should change the naming in your map callback
{props.duties.map((duty, i) => {
return <li key={i}>{duty}</li>
})}
Currently
In your use of props.duties.map(resume => ..., resume is your abitrary variable name for each element in duties, and it's not being used in your return.
I am a fairly new web developer and would need your help with a project I am currently working on. I have worked in the past on a very simple realtime database example and have little to none experience in firestore or NoSql in general.
I want to create a system which allows end-users to get an email once a week that contains a list of special offers from bars the end-user has subscribed to. The offers change each day of the week. Bar owners can fill out a form in a vue.js web application every week with their weekly special offers.
Every Monday morning a cron job has to look up which end user has subscribed to which bars and then aggregate the data and send it via email.
The question is how would you structure the data so that I can easily compose the email and send it via a cloud function?
My approach would be to have three main collections: RestaurantOwner, EndUser, SpecialOfferings
Please see the graphic for an example process:
BarOwner and EndUser are pretty straight forward. However, the difficult part is how to structure the SpecialOffers in order to be queried the right way.
My idea would be to structure it based on the calendar week and link it to the uid from the barOwner:
specialOffers: {
2019_CW27: {
barUID001: {
mon: {
title: 'Banana Daiquir',
price: 4.99,
},
tue: {
title: 'After Five',
price: 2.99,
},
wed: {
title: 'Cool Colada',
price: 6.99
},
thu: {
title: 'Crantini',
price: 5.99
},
fri: {
title: 'French Martini',
price: 4.99
}
},
barUID002: {
mon: {
title: 'Gin & Tonic',
price: 8.99,
},
tue: {
title: 'Cratini',
price: 4.99,
},
wed: {
title: 'French Martini',
price: 4.99
},
thu: {
title: 'After Five',
price: 3.99
},
fri: {
title: 'Cool Colada',
price: 6.99
}
}
},
2019_CW28: {
barUID01: {~~~},
barUID02: {~~~}
}
}
The disadvantage of this approach is that it creates a deeply nested object when you imagine that there are 52 calendar weeks, f.e 100 signed up bars à 5 special offers per week and I am not sure if I am able to query it the way I need to.
Is this approach reasonable or what would you do differently?
Thank you so much for your help! I highly appreciate it.
I'm assuming the following scenarios:
1) The bar owners make modifications to their offers very often.
2) The bar owners should be the only ones allowed to modify each bar's offers.
If you have these two scenarios, I would recommend a sub-collections approach here.
When to use sub-collections:
1) When there are lot of fields in a document. Cloud Firestore has 20,000 field limit. (If the number of Bars can exceed more than 20,000 fields)
2) When updating the parent collection is a common operation. Firestore only lets you update the document at rate of 1 write/second. (If the SpecialOffers information of each bar is modified very often. If two bar owners modify their offers, only 1 write is successful and the second write operation waits until the first is completed. This can delay the updation offers particularly at the end of a week when almost all the bars update the offers.)
3) When you want to limit the access to particular fields of a document. (If you want to restrict the access to a Bar's Offers to the barOwner alone. You can restrict the access to each document in the Bars sub-collection according to its owner using Firestore Security Rules)
So I would recommend a sub-collection Bars under the main collection SpecialOffers. This way the design becomes scalable and you can add restaurants and super-markets as other similar sub-collections in the future without heavily altering your design.
Another advantage is that sub-collections are basically collections and they don't have a limit for number of documents it can hold. So even if the number of bars registered is above 20,000 which is the limit of number of fields for a fire-store document, your sub-collection wont be having a problem but your document will run out of fields to save the offers for a new bar.
Ultimately the choice depends on your use cases.
Hope this helps.
How do i remove all html tags from a string using Codename One. See below sample spring.
<p><b>Introduction to the Course</b><br /></p><p>Dear learner, welcome to the <span style=\"font-size:11pt;font-family:'Franklin Gothic Book', 'sans-serif';\" lang=\"en-gb\" xml:lang=\"en-gb\">Effective Management and Control of Asthma training programme.</span> The<span style=\"font-size:11pt;font-family:'Franklin Gothic Book', 'sans-serif';\" lang=\"en-gb\" xml:lang=\"en-gb\"> training programme</span> </p><p>Happy learning!<br /></p>
You could construct a suitable com.codename1.util.regex.RE object and substitute a blank string for the tags.
I am new to angularjs and i am having problems with loading partials in codeigniter.
controller:
function angular(){
$this->load->view('admin/header');
$this->load->view('admin/angulardata');
$this->load->view('admin/footer');
}
angulardata.php
<div class="right">
<div ng-view>
</div>
</div>
angular.js
var artistControllers=angular.module('artistControllers',[]);
artistControllers.controller('ListController',function($scope){
$scope.artists=[
{
"name":"Barot Bellingham",
"shortname":"Barot_Bellingham",
"reknown":"Royal Academy of Painting and Sculpture",
"bio":"Barot has just finished his final year at The Royal Academy of Painting and Sculpture, where he excelled in glass etching paintings and portraiture. Hailed as one of the most diverse artists of his generation, Barot is equally as skilled with watercolors as he is with oils, and is just as well-balanced in different subject areas. Barot's collection entitled \"The Un-Collection\" will adorn the walls of Gilbert Hall, depicting his range of skills and sensibilities - all of them, uniquely Barot, yet undeniably different"
},
{
"name":"Jonathan G. Ferrar II",
"shortname":"Jonathan_Ferrar",
"reknown":"Artist to Watch in 2012",
"bio":"The Artist to Watch in 2012 by the London Review, Johnathan has already sold one of the highest priced-commissions paid to an art student, ever on record. The piece, entitled Gratitude Resort, a work in oil and mixed media, was sold for $750,000 and Jonathan donated all the proceeds to Art for Peace, an organization that provides college art scholarships for creative children in developing nations"
},
{
"name":"Hillary Hewitt Goldwynn-Post",
"shortname":"Hillary_Goldwynn",
"reknown":"New York University",
"bio":"Hillary is a sophomore art sculpture student at New York University, and has already won all the major international prizes for new sculptors, including the Divinity Circle, the International Sculptor's Medal, and the Academy of Paris Award. Hillary's CAC exhibit features 25 abstract watercolor paintings that contain only water images including waves, deep sea, and river."
},
{
"name":"Hassum Harrod",
"shortname":"Hassum_Harrod",
"reknown":"Art College in New Dehli",
"bio":"The Art College in New Dehli has sponsored Hassum on scholarship for his entire undergraduate career at the university, seeing great promise in his contemporary paintings of landscapes - that use equal parts muted and vibrant tones, and are almost a contradiction in art. Hassum will be speaking on \"The use and absence of color in modern art\" during Thursday's agenda."
},
{
"name":"Jennifer Jerome",
"shortname":"Jennifer_Jerome",
"reknown":"New Orleans, LA",
"bio":"A native of New Orleans, much of Jennifer's work has centered around abstract images that depict flooding and rebuilding, having grown up as a teenager in the post-flood years. Despite the sadness of devastation and lives lost, Jennifer's work also depicts the hope and togetherness of a community that has persevered. Jennifer's exhibit will be discussed during Tuesday's Water in Art theme."
}
]
});
app.js
var myApp=angular.module('myApp',[
'ngRoute',
'artistControllers'
]);
myApp.config(['$routeProvider',function($routeProvider){
$routeProvider.
when('/list',{
templateUrl:'partials/list.php',
controller:'ListController'
}).otherwise({
redirectTo:'/list'
});
}]);
and list.php which is located in views/admin/partials/list.php
<div>
<input ng-model="query" placeholder="Search for Artists">
</div>
<ul>
<li ng-repeat="item in artists | filter: query">
<div>
<h2>{{item.name}}</h2>
<h3>{{item.reknown}}</h3>
</div>
</li>
</ul>
How can i make this work?
Solution: Just change one line.
First Way:-
Give full path here:
templateUrl:'partials/list.php',
Change it to :
templateUrl:'[full-path]/partials/list.php',
Eg. [full-path] = http://localhost/mysystem/
Second way:-
You can store base-path into javascript variable as:
var base_url="http://localhost/mysstem/";
and the code line becomes like this:
templateUrl:base_url+'partials/list.php',
Hope it helps.