MODX: MIGX Extremely slow load times - content-management-system

I'm currently implementing MODX into a current site. (click here)
As you can probably tell, loading the site takes an absurd amount of time for something mostly textual. It loaded very quickly before I was using this CMS, so I'm assuming that it's just taking a very long time to request information from my database.
Here's how I have it set up: Each item under the category is included like this:
[[!getImageList?
&tvname=`lunchSoups`
&tpl=`menuItem`
]]
So, seeing as I have both Dinner + Lunch menus as well as all of these items, I end up with 14 requests. Is this what's slowing my page down, or is it just the amount of information? How can I reduce the load time?
Edit: I've taken out the ! in getImageList, so now it caches. The initial load is still extremely slow, though.
Edit: TPL Chunk:
I thought maybe the conditional type statements might be slowing down the website, but they seem to be the same speed without them.
[[+item:notempty=`
<h2>
<span>[[+item]] / <span>[[+price]]</span>
</h2>
`]]
<h3>
<span>[[+description]]</span>
</h3>
[[+addItem:notempty=`
</br>
<h2 style="font-style:italic; font-size: 13px; padding-bottom: 0px; padding-top: 0px; text-align: center; line-height: 1.2;">
[[+addItem]]
</h2>
</br>
`]]

Related

Can I stop the cdkDropList from expanding in Angular12

I am using Angular 12 drag and drop to move a mat-list-item to "dropzone" (cdkDropList) in another component.
When I drag the item over the droplist, the droplist expands as if to make room for the item. Since this is not really a list, this behavior is undesirable. How can I stop it from expanding?
<mat-list-item
cdkDrag
[cdkDragDisabled]="!isDraggable"
[cdkDragData]="r.id"
(click)="selectRecord(r, i)"
*ngFor="
let r of recordList | filterList: searchText:filterField;
let i = index">
<p id="{{ 'Item-' + r.id }}" [innerHTML]="lineTitle(r)"
matLine></p>
</mat-list-item>
<div
(cdkDropListDropped)="svc.dropSub1($event)"
*ngIf="!svc.sub1"
cdkDropList
class="drag-here-column text-center"
style="border: 1px grey dotted; line-height: 300px; font-size: smaller; font-style: italic;">
Drag preferred subject here
</div>
I tried to used dragula but although is easier to configure I ended up having the same issue, where dragula will just add more elements when the destination is full and changing that behaviour was not obvious to me
After searching in many places about how to avoid cdkDropList from autoexpading or growing, I ended up doing a custom drag/drop approach, especially because I need to have placeholders as destination of my objects.
Is really useful to set HTML IDs to each element that is going to be dragged, in this way you can recognize origin and destination based on those id (for example concatenating a prefix of the container with the position ('contA_1','contB_9')
Here is one basic example that once you understand can help you setup your drag/drop event handlers and how to update the model to reflect the drop operation
https://idkblogs.com/angular2/2/Implement-Drag-and-Drop-in-Angular-2-4-5-6

AdminLTE content-wrapper min-height issue

It seems that Admin LTE sets the min-height value for ` and also the side bar. For some reason, in my case, this value is getting calculated to be way higher than it should, which causes the side bar to be unnecessarily long. See the screenshot below.
How can this be fixed?
you need add this to this body tag
class="skin-blue fixed sidebar-mini sidebar-mini-expand-feature" style="height: auto; min-height: 100%;"
like this:
<body class="skin-blue fixed sidebar-mini sidebar-mini-expand-feature" style="height: auto; min-height: 100%;"></body>
this fix it, i have the same problem
this is a way to fix it. you can put these code to fix.js
function initFix(){
$('body').layout('fix');
}
$(function(){
setTimeout(initFix,0);
});

Using T-SQL to replace HTML in table not working

I'm trying to do a replace to get some unwanted content out of our Sitefinity Content blocks. To do this I've created a script to replace a term with an empty string. See for yourself:
DECLARE #SearchText nvarchar(512),
#ReplaceText nvarchar(512)
SET #SearchText = '%<img width="19" height="16" alt="" style="margin: 0px; vertical-align: middle;border: 0px solid;" src="http://www.eua.be/uploads/RTEmagicC_d6849d8eef_44a388.gif.gif" />%';
SET #ReplaceText = '';
select * from sf_control_properties where val like #SearchText
update sf_control_properties set val = REPLACE(val, #SearchText, #ReplaceText)
It does find the content when I run the select, but the replace function doesn't seem to be doing much. I have no clue what is going on, can someone spot the error?
An example database value that should be replaced is below.
<p>Europe’s universities are increasingly developing partnerships in their research and innovation missions, embracing the “Open Innovation model” of university-business collaboration and seeking to embed this is in sound project management and improved intellectual property management that reflects respective interests.</p> <p>The Responsible Partnering Initiative has been developed through close collaboration between EUA, the European Industrial Research Management Association (EIRMA), the European Association of Research and Technology Organisations (EARTO) and the European Network of Knowledge Transfer Offices linked to Universities and Public Research Organisations (ProTon Europe).<br /> <br />
The origins of the <a sfref="[documents]47af5eca-84b9-6a87-9ce5-ff00009465c7" href="/Libraries/research/2004_Responsible_Partnering_-_ConferenceReportFinal.pdf?sfvrsn=0" target="_blank">Responsible Partnering Initiative</a> <img width="19" height="16" alt="" style="margin: 0px; vertical-align: middle;border: 0px solid;" src="http://www.eua.be/uploads/RTEmagicC_d6849d8eef_44a388.gif.gif" /> date back to a major Conference which was held in 2004 which brought together the main stakeholders from universities, industry and public research organisations. As a result of the conference, a handbook based on good practices in university/industry collaborative research was published in 2005, entitled “<a sfref="[documents]4daf5eca-84b9-6a87-9ce5-ff00009465c7" href="/Libraries/research/2005_Responsible_Partnering_rp-2005-v102_2.pdf?sfvrsn=0" target="_blank">Responsible Partnering: Joining Forces in a World of Open Innovation</a>”. <img width="19" height="16" alt="" style="margin: 0px; vertical-align: middle;border: 0px solid;" src="http://www.eua.be/uploads/RTEmagicC_d6849d8eef_44a388.gif.gif" /></p> <p>A guide to better practices for collaborative research and knowledge transfer between science and industry, the Responsible Partnering Handbook was designed to help senior managers in the public and private sectors responsible for the creation, transfer and application of knowledge. It is seen as a useful step in the process of facilitating more regular interactions between European universities and industry, of building trust and establishing mutually beneficial relations, while respecting each others' core objectives.<br /> <br />
The Responsible Partnering Guidelines cover core areas that are crucial to university/industry collaboration concerning aligning interests, professional training and skills, consortia-building, intellectual property rights and patents and finally, importantly, building lasting relationships in collaborative research. The guidelines have been recognised as a pioneering European initiative in various European Commission Communications on improving knowledge transfer and the management of intellectual property rights, and have been recommended strongly for further implementation by the “<a sfref="[documents]71af5eca-84b9-6a87-9ce5-ff00009465c7" href="/Libraries/research/aho_report.pdf?sfvrsn=0" target="_blank">Aho Report on Creating an Innovative Europe</a>”. <img width="19" height="16" alt="" style="margin: 0px; vertical-align: middle;border: 0px solid;" src="http://www.eua.be/uploads/RTEmagicC_d6849d8eef_44a388.gif.gif" /></p> <p>The Responsible Partnering Guidelines is a “living document” that is revised regularly in the light of further evidence of good practices and to address new issues in university-business research collaboration. Revisions have been made through “validation workshops” organised with the support from the European Commission DG Research, to gain critical feedback on their strengths and weaknesses and potential for further development and implementation. Workshop participants were drawn from universities, industry (both large and small business enterprises), public research organisations, knowledge transfer offices and other interested parties. A Special Conference was held in Lisbon, Portugal in December 2007, and the report from the conference is available <a sfref="[documents]d7b05eca-84b9-6a87-9ce5-ff00009465c7" href="/Libraries/research/Responsible_Partnering_-_2007_Lisbon_Conference.pdf?sfvrsn=0" target="_blank">here</a> <img width="19" height="16" alt="" style="margin: 0px; vertical-align: middle;border: 0px solid;" src="http://www.eua.be/uploads/RTEmagicC_d6849d8eef_44a388.gif.gif" />. </p> <p>In October 2009 a fully revised <a sfref="[documents]b3ad5eca-84b9-6a87-9ce5-ff00009465c7" href="/Libraries/publications-homepage-list/Responsible_Partnering_Guidelines_09.pdf?sfvrsn=0">'Responsible Partnering Guidelines'</a> <img width="19" height="16" alt="" style="margin: 0px; vertical-align: middle;border: 0px solid;" src="http://www.eua.be/uploads/RTEmagicC_d6849d8eef_44a388.gif.gif" />was published which include issues such as State Aid, European Community recommendations on IPR management and the results of the EUA DOC-CAREERS project on university-industry partnerships in doctoral research. The Steering Group for the Responsible Partnering Initiative contributes currently also to the <strong>EC-initiated University-Business Forum</strong> and promotes dialogue with the European Institute of Technology (EIT). </p> <p>EUA has also proposed to the European Research Area Board (ERAB) that the Responsible Partnering Guidelines should be taken forward as a best practice in the first steps to creating an “Open Innovation Charter” proposed as an ERA Milestone in the ERAB’s recommendations in its “Strategic View of the European Research Area: Preparing Europe for a New Renaissance<img width="19" height="16" alt="" style="margin: 0px; vertical-align: middle;border: 0px solid;" src="http://www.eua.be/uploads/RTEmagicC_d6849d8eef_44a388.gif.gif" />.</p>
CREATE TABLE #Text (c1 varchar(100))
INSERT INTO #Text VALUES ('ASDF')
INSERT INTO #Text VALUES ('BCDE')
INSERT INTO #Text VALUES ('CDE')
DECLARE #SearchText nvarchar(512),
#ReplaceText nvarchar(512),
#SearchReplacement nvarchar(512)
SET #SearchText = '%DF%';
SET #SearchReplacement = 'DF'
SET #ReplaceText = '';
select * from #Text where c1 like #SearchText
update #Text set c1 = REPLACE(c1, #SearchReplacement, #ReplaceText)
REPLACE can't find the text because of the '% %' you have in #SearchText. You could also use SUBSTRING to remove the '%' in #SearchText
I am a dumbass.
Obviously the replace statement does not understand wildcard characters like the %.
I've updated the function like so which did work.
DECLARE #SearchText nvarchar(512),
#ReplaceText nvarchar(512)
SET #SearchText = '%<img width="19" height="16" alt="" style="margin: 0px; vertical-align: middle;border: 0px solid;" src="http://www.eua.be/uploads/RTEmagicC_d6849d8eef_44a388.gif.gif" />%';
SET #ReplaceText = '';
select * from sf_control_properties where val like #SearchText
SET #SearchText = REPLACE(#SearchText, '%', '')
SELECT 'Replacing ' + #SearchText + ' with ' + #ReplaceText
update sf_control_properties set val = REPLACE(val, #SearchText, #ReplaceText)

Moodle export lesson contents with images

I am trying to export Moodle lesson content from Moodle database, but I am having problems exporting images. Moodle stores lesson HTML in a MySQL database but images are referenced and need to be replaced in the HTML string.
For example. This is the source html that is saved in Moodle DB:
<p>
<img style="display: block; margin-left: auto; margin-right: auto;" src="##PLUGINFILE##/sound_card_zpstlml0qfv.png" height="492" width="720" /
</p>
Moodle transforms this into final html:
<p>
<img style="display: block; margin-left: auto; margin-right: auto;" src="http://mymoodleserver.com/pluginfile.php/553/mod_lesson/page_contents/1725/sound_card_zpstlml0qfv.png" height="492" width="720" /
</p>
I have figured out that ##PLUGINFILE## needs to be replaced with the path to the image file but I just don't know what is the first number in the final image URL. I guess it is some ID but I can figure out what. I figured out the second number in the URL is id from lesson_pages table.
http://mymoodleserver.com/pluginfile.php/SOME_ID/mod_lesson/page_contents/PAGE_ID/image_file.jpg
Isn't the first number in the final image URL (553, in your example) an id from mdl_files table?
What I still don't understand is the relationship between the file in the mdl_files table and the actual image file.
Please post the answer, if you found it.

Span inside text input field?

Is it somehow possible to place a span as the value of a text input field?
I am making a mailing system for a website and want a nice looking receivers input field, where added receivers are contained and added to the value of input text field. At the moment i use a separate "adding field" while showing added receivers in a span-container. I want to merge these to fields together. Just like any input field in regular e-mail software.
Help would be most appreciated! Thanks in advance!
Short answer: no, you cannot include a <span /> within an <input />.
You have a few options. You could use javascript to emulate behaviour like the email To: field. E.g. listen to key presses and handle actions like backspace after a ;.
Another option would be to make a list appear (css styled) like a textbox. Have the last <li /> contain a textbox with cleared styles. Every time the user adds a new email then insert a new <li /> before the textbox.
E.G.
html:
<ul class="email-textbox">
<li>bob#email.com;</li>
<li>jane#email.com;</li>
<li><input type="text" /></li>
</ul>
css:
.email-textbox {
background-color: #fff;
border: 1px solid #ccc;
padding: 2px 4px;
}
.email-textbox li {
display: inline-block;
list-style: none;
margin-left: 5px;
}
.email-textbox input {
background: none;
border: none;
}
javascript (jQuery, can change to vanilla)
$(function () {
$('.email-textbox').find('input').focus();
});
You will need to extend this javascript to include a keypress handler etc, but it gives the general idea.
Demo: http://jsfiddle.net/UeTDw/1/
Any option will require some javascript however.
If you can use jQuery, you could check out jQuery UI autocomplete
One way to do it would be to layer a text input on top of a div that is styled to look like a text input.
<div id="fake-input">
<span class="input-item">John Doe</span>
<span class="input-item">Jane Deere</span>
<input id="receiver-input" type="text" />
</div>
You can strip all styling off of receiver-input, and add borders, background colors, and such to fake-input so that it appears to be a text field. When a receiver is added, you can create a new input-item span and append it to the list.
Input text fields are typically used to accept raw text input. Attempting to wrap input text inside of a text field opens you to user error and potential difficulties with parsing data if the person is able to manipulate the tags.
Personally I would suggest keeping your current method but enabling some form of AJAX support to make things more dynamic and less error-prone to the user.
(My $0.02)
TextExtjs is probably what you want. It's a jquery plugin for allowing removable tags with autocompletion etc in a textarea.
And here is a related SO discussion - where I found this plugin - on mimicking the similar behavior found in some inputs on facebook.